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)
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)
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)
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)
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)
def test_array(): cls = query.get_cli_class('System.Object[]') assert cls._INSTANCE._isArray assert cls._INSTANCE._ELEMENT is CLR.System.Object._INSTANCE