Beispiel #1
0
 def load(self, builder):
     holdertype = box(self.holder).GetType()
     funcfield = holdertype.GetField('func')
     delegatetype = self.delegatetype
     index = self._get_index(builder)
     self._load_from_array(builder, index, holdertype)
     builder.il.Emit(OpCodes.Ldfld, funcfield)
     builder.il.Emit(OpCodes.Castclass, delegatetype)
Beispiel #2
0
 def fn(flag):
     a = ArrayList()
     a.Add(None)
     if flag:
         obj = cliupcast(a, System.Object)
     else:
         obj = box(42)
     b = clidowncast(obj, ArrayList)
     return b.get_Item(0)
Beispiel #3
0
 def fn(flag):
     a = ArrayList()
     a.Add(None)
     if flag:
         obj = cliupcast(a, System.Object)
     else:
         obj = box(42)
     b = clidowncast(obj, ArrayList)
     return b.get_Item(0)
Beispiel #4
0
 def genconst(self, llvalue):
     T = ootype.typeOf(llvalue)
     if T is ootype.Signed:
         return IntConst(llvalue)
     elif T is ootype.Bool:
         return IntConst(int(llvalue))
     elif isinstance(T, ootype.OOType):
         return ObjectConst(box(llvalue))
     else:
         assert False, "XXX not implemented"
Beispiel #5
0
def call_method(space, b_obj, b_type, name, w_args, startfrom):
    b_args, b_paramtypes = rewrap_args(space, w_args, startfrom)
    b_meth = get_method(space, b_type, name, b_paramtypes)
    try:
        # for an explanation of the box() call, see the log message for revision 35167
        b_res = box(b_meth.Invoke(b_obj, b_args))
    except TargetInvocationException, e:
        b_inner = native_exc(e).get_InnerException()
        message = str(b_inner.get_Message())
        # TODO: use the appropriate exception, not StandardError
        raise OperationError(space.w_StandardError, space.wrap(message))
Beispiel #6
0
def call_method(space, b_obj, b_type, name, w_args, startfrom):
    b_args, b_paramtypes = rewrap_args(space, w_args, startfrom)
    b_meth = get_method(space, b_type, name, b_paramtypes)
    try:
        # for an explanation of the box() call, see the log message for revision 35167
        b_res = box(b_meth.Invoke(b_obj, b_args))
    except TargetInvocationException, e:
        b_inner = native_exc(e).get_InnerException()
        message = str(b_inner.get_Message())
        # TODO: use the appropriate exception, not StandardError
        raise OperationError(space.w_StandardError, space.wrap(message))
 def fn():
     x = ArrayList()
     t = x.GetType()
     meth = t.GetMethod('get_Item')
     args = init_array(System.Object, box(0))
     try:
         meth.Invoke(x, args)
         return "Impossible!"
     except TargetInvocationException, e:
         inner = native_exc(e).get_InnerException()
         message = str(inner.get_Message())
         return message
Beispiel #8
0
 def fn():
     x = ArrayList()
     t = x.GetType()
     meth = t.GetMethod('get_Item')
     args = init_array(System.Object, box(0))
     try:
         meth.Invoke(x, args)
         return "Impossible!"
     except TargetInvocationException, e:
         inner = native_exc(e).get_InnerException()
         message = str(inner.get_Message())
         return message
 def fn():
     x = ArrayList()
     x.Add(box(42))
     array = x.ToArray()
     return unbox(array[0], ootype.Signed)
 def fn():
     x = box(42)
     t = x.GetType()
     return t.get_Name()
 def fn():
     x = ArrayList()
     x.Add(box(42))
     return unbox(x.get_Item(0), ootype.Signed)
Beispiel #12
0
 def fn():
     boxed = box(Foo())
     return unbox(boxed, Foo)
 def fn(flag):
     if flag:
         return box(42)
     else:
         return box(None)
 def fn():
     int32_obj = box(int32_class)
     int32_type = clidowncast(int32_obj, System.Type)
     return int32_type.get_Name()
Beispiel #15
0
 def fn():
     x = ArrayList()
     x.Add(box('foo'))
     return unbox(x.get_Item(0), ootype.String)
Beispiel #16
0
 def fn():
     x = init_array(System.Object, box(42), box(43))
     x[0] = None
     return x[0]
Beispiel #17
0
 def fn():
     x = init_array(System.Object, box(42), box(43))
     return unbox(x[0], ootype.Signed) + unbox(x[1], ootype.Signed)
Beispiel #18
0
 def fn():
     x = new_array(System.Object, 2)
     x[0] = box(42)
     x[1] = box(43)
     return unbox(x[0], ootype.Signed) + unbox(x[1], ootype.Signed)
Beispiel #19
0
 def fn():
     x = ArrayList()
     x.Add(box(42))
     array = x.ToArray()
     return unbox(array[0], ootype.Signed)
Beispiel #20
0
 def fn():
     return box(System.Object()).ToString()
Beispiel #21
0
 def fn():
     x = box(42)
     t = x.GetType()
     return t.get_Name()
 def fn():
     x = init_array(System.Object, box(42), box(43))
     return unbox(x[0], ootype.Signed) + unbox(x[1], ootype.Signed)
 def fn():
     x = init_array(System.Object, box(42), box(43))
     return len(x)
Beispiel #24
0
 def fn():
     x = init_array(System.Object, box(42), box(43))
     return len(x)
 def fn(flag):
     a = ootype.new(A)
     a.xx = 42
     b_obj = box(a)
     a2 = unbox(b_obj, A)
     return a2.xx
Beispiel #26
0
 def fn():
     x = box(42)
     return x.GetType() == typeof(System.Int32)
 def fn():
     obj = box(c)
     t = clidowncast(obj, System.Type)
     return t.get_Name()
Beispiel #28
0
 def fn(flag):
     if flag:
         x = None
     else:
         x = box(42)
     return g(x)
Beispiel #29
0
 def fn():
     x = ArrayList()
     x.Add(box(42))
     x.Add(box('Foo'))
     return x.get_Count()
Beispiel #30
0
 def fn():
     obj = Foo()
     b_obj = box(obj)
     obj2 = unbox(b_obj, Foo)
     return obj is obj2
 def fn():
     x = ArrayList()
     x.Add(box(42))
     x.Add(box('Foo'))
     return x.get_Count()
Beispiel #32
0
 def fn():
     b_obj = box(42)
     return unbox(b_obj, Foo)
 def fn():
     x = ArrayList()
     x.Add(box('foo'))
     return unbox(x.get_Item(0), ootype.String)
Beispiel #34
0
 def fn(flag):
     a = ootype.new(A)
     a.xx = 42
     b_obj = box(a)
     a2 = unbox(b_obj, A)
     return a2.xx
 def fn():
     return box(System.Object()).ToString()
Beispiel #36
0
 def fn():
     obj = Foo()
     x = ArrayList()
     x.Add(box(obj))
     obj2 = unbox(x.get_Item(0), Foo)
     return obj is obj2
 def fn():
     x = new_array(System.Object, 2)
     x[0] = box(42)
     x[1] = box(43)
     return unbox(x[0], ootype.Signed) + unbox(x[1], ootype.Signed)
 def fn():
     x = box(42)
     return x.GetType() ==  typeof(System.Int32)
 def fn():
     x = init_array(System.Object, box(42), box(43))
     x[0] = None
     return x[0]
 def fn():
     obj = Foo()
     b_obj = box(obj)
     obj2 = unbox(b_obj, Foo)
     return obj is obj2
Beispiel #41
0
 def fn():
     int32_obj = box(int32_class)
     int32_type = clidowncast(int32_obj, System.Type)
     return int32_type.get_Name()
Beispiel #42
0
 def fn():
     x = ArrayList()
     x.Add(box(42))
     return unbox(x.get_Item(0), ootype.Signed)
 def fn(flag):
     if flag:
         x = None
     else:
         x = box(42)
     return g(x)
Beispiel #44
0
 def fn(flag):
     if flag:
         x = a
     else:
         x = b
     return clidowncast(box(x), System.Type).get_Name()
 def fn():
     b_obj = box(42)
     return unbox(b_obj, Foo)
Beispiel #46
0
 def fn():
     obj = box(c)
     t = clidowncast(obj, System.Type)
     return t.get_Name()
 def fn():
     obj = Foo()
     x = ArrayList()
     x.Add(box(obj))
     obj2 = unbox(x.get_Item(0), Foo)
     return obj is obj2
Beispiel #48
0
 def fn():
     return box(42)
 def fn(flag):
     if flag:
         x = a
     else:
         x = b
     return clidowncast(box(x), System.Type).get_Name()
Beispiel #50
0
 def tocli(self):
     return box(self.intval)
 def fn():
     return box(42)
Beispiel #52
0
 def tocli(self):
     return box(self.boolval)
 def fn(x):
     if x:
         return None
     else:
         return box(42)
Beispiel #54
0
 def fn():
     x = StringBuilder()
     x.Append(box("foo")).Append(box("bar"))
     return x.ToString()
Beispiel #55
0
 def tocli(self):
     return box(self)
 def fn():
     return box(Foo())
Beispiel #57
0
 def tocli(self):
     return box(self.floatval)
 def fn():
     boxed = box(Foo())
     return unbox(boxed, Foo)
Beispiel #59
0
 def tocli(self):
     return box(self._value)
 def fn():
     x = StringBuilder()
     x.Append(box("foo")).Append(box("bar"))
     return x.ToString()