Esempio n. 1
0
File: dotnet.py Progetto: sota/pypy
 def annotation_to_lltype(cls, ann):
     if isinstance(ann, SomeChar):
         return ootype.Char
     elif isinstance(ann, SomeString):
         return ootype.String
     else:
         return annotation_to_lltype(ann)
Esempio n. 2
0
 def annotation_to_lltype(cls, ann):
     if isinstance(ann, SomeChar):
         return ootype.Char
     elif isinstance(ann, SomeString):
         return ootype.String
     else:
         return annotation_to_lltype(ann)
Esempio n. 3
0
 def call(p, args):
     args_s, kwds_s = args.unpack()
     if kwds_s:
         raise Exception("keyword arguments to call to a low-level fn ptr")
     info = 'argument to ll function pointer call'
     llargs = [annotation_to_lltype(s_arg,info)._defl() for s_arg in args_s]
     v = p.ll_ptrtype._example()(*llargs)
     return ll_to_annotation(v)
Esempio n. 4
0
def cast_primitive(T, s_v):
    assert T.is_constant()
    return ll_to_annotation(lltype.cast_primitive(T.const, annotation_to_lltype(s_v)._defl()))
Esempio n. 5
0
def typeOf(s_val):
    lltype = annotation_to_lltype(s_val, info="in typeOf(): ")
    return immutablevalue(lltype)
Esempio n. 6
0
 def setattr(p, s_attr, s_value): # just doing checking
     assert s_attr.is_constant(), "setattr on ptr %r with non-constant field-name" % p.ll_ptrtype
     example = p.ll_ptrtype._example()
     if getattr(example, s_attr.const) is not None:  # ignore Void s_value
         v_lltype = annotation_to_lltype(s_value)
         setattr(example, s_attr.const, v_lltype._defl())
Esempio n. 7
0
 def annotation_to_cts(self, _tp):
     s_tp = annotation(_tp)
     TP = annotation_to_lltype(s_tp)
     return self.lltype_to_cts(TP)