Example #1
0
 def compute_result_annotation(self, type_s, length_s):
     from pypy.translator.cli.query import get_cli_class
     assert type_s.is_constant()
     assert isinstance(length_s, SomeInteger)
     TYPE = type_s.const._INSTANCE
     fullname = '%s.%s[]' % (TYPE._namespace, TYPE._classname)
     cliArray = get_cli_class(fullname)
     return SomeOOInstance(cliArray._INSTANCE)
Example #2
0
 def compute_result_annotation(self, type_s, length_s):
     from pypy.translator.cli.query import get_cli_class
     assert type_s.is_constant()
     assert isinstance(length_s, SomeInteger)
     TYPE = type_s.const._INSTANCE
     fullname = '%s.%s[]' % (TYPE._namespace, TYPE._classname)
     cliArray = get_cli_class(fullname)
     return SomeOOInstance(cliArray._INSTANCE)
Example #3
0
 def simple_call(self, *s_args):
     from pypy.translator.cli.query import get_cli_class
     DELEGATE = get_cli_class('System.Delegate')._INSTANCE
     if ootype.isSubclass(self.ootype, DELEGATE):
         s_invoke = self.getattr(immutablevalue('Invoke'))
         return s_invoke.simple_call(*s_args)
     else:
         # cannot call a non-delegate
         return SomeObject.simple_call(self, *s_args)
Example #4
0
 def simple_call(self, *s_args):
     from pypy.translator.cli.query import get_cli_class
     DELEGATE = get_cli_class('System.Delegate')._INSTANCE
     if ootype.isSubclass(self.ootype, DELEGATE):
         s_invoke = self.getattr(immutablevalue('Invoke'))
         return s_invoke.simple_call(*s_args)
     else:
         # cannot call a non-delegate
         return SomeObject.simple_call(self, *s_args)
Example #5
0
 def compute_result_annotation(self, type_s, *args_s):
     from pypy.translator.cli.query import get_cli_class
     assert type_s.is_constant()
     TYPE = type_s.const._INSTANCE
     for i, arg_s in enumerate(args_s):
         if TYPE is not arg_s.ootype:
             raise TypeError, 'Wrong type of arg #%d: %s expected, %s found' % \
                   (i, TYPE, arg_s.ootype)
     fullname = '%s.%s[]' % (TYPE._namespace, TYPE._classname)
     cliArray = get_cli_class(fullname)
     return SomeOOInstance(cliArray._INSTANCE)
Example #6
0
 def compute_result_annotation(self, type_s, *args_s):
     from pypy.translator.cli.query import get_cli_class
     assert type_s.is_constant()
     TYPE = type_s.const._INSTANCE
     for i, arg_s in enumerate(args_s):
         if TYPE is not arg_s.ootype:
             raise TypeError, 'Wrong type of arg #%d: %s expected, %s found' % \
                   (i, TYPE, arg_s.ootype)
     fullname = '%s.%s[]' % (TYPE._namespace, TYPE._classname)
     cliArray = get_cli_class(fullname)
     return SomeOOInstance(cliArray._INSTANCE)
Example #7
0
 def compute_result_annotation(self, s_value):
     from pypy.translator.cli.query import get_cli_class
     cliType = get_cli_class('System.EventHandler')
     return SomeOOInstance(cliType._INSTANCE)
Example #8
0
 def compute_result_annotation(self, cliClass_s):
     from pypy.translator.cli.query import get_cli_class
     assert cliClass_s.is_constant()
     cliType = get_cli_class('System.Type')
     return SomeOOInstance(cliType._INSTANCE)
Example #9
0
 def compute_result_annotation(self, s_value):
     from pypy.translator.cli.query import get_cli_class
     cliType = get_cli_class('System.EventHandler')
     return SomeOOInstance(cliType._INSTANCE)
Example #10
0
 def compute_result_annotation(self, cliClass_s):
     from pypy.translator.cli.query import get_cli_class
     assert cliClass_s.is_constant()
     cliType = get_cli_class('System.Type')
     return SomeOOInstance(cliType._INSTANCE)
Example #11
0
def test_array():
    cls = query.get_cli_class('System.Object[]')
    assert cls._INSTANCE._isArray
    assert cls._INSTANCE._ELEMENT is CLR.System.Object._INSTANCE