def describe_function(interp, typemap, restype, calltypes, mangler): fname, pymod, doc, args, kws = _describe(interp) native = True sortedblocks = utils.SortedMap(utils.dict_iteritems(interp.blocks)) fd = FunctionDescriptor(native, pymod, fname, doc, sortedblocks, typemap, restype, calltypes, args, kws, mangler) return fd
def describe_function(interp, typemap, restype, calltypes): fname, pymod, doc, args, kws = _describe(interp) native = True sortedblocks = utils.SortedMap(utils.dict_iteritems(interp.blocks)) fd = FunctionDescriptor(native, pymod, fname, doc, sortedblocks, typemap, restype, calltypes, args, kws) return fd
def dump(self): def label_marker(i): if i[1].offset in self.labels: return '>' else: return ' ' return '\n'.join('%s %10d\t%s' % ((label_marker(i),) + i) for i in utils.dict_iteritems(self.table))
def _from_python_function(cls, interp, typemap, restype, calltypes, native, mangler=None): (qualname, unique_name, modname, doc, args, kws, func_globals )= cls._get_function_info(interp) sortedblocks = utils.SortedMap(utils.dict_iteritems(interp.blocks)) self = cls(native, modname, qualname, unique_name, doc, sortedblocks, typemap, restype, calltypes, args, kws, mangler=mangler, globals=func_globals) return self
def dump(self): def label_marker(i): if i[1].offset in self.labels: return '>' else: return ' ' return '\n'.join('%s %10d\t%s' % ((label_marker(i), ) + i) for i in utils.dict_iteritems(self.table))
def describe_pyfunction(interp): fname, pymod, doc, args, kws = _describe(interp) defdict = lambda: defaultdict(lambda: types.pyobject) typemap = defdict() restype = types.pyobject calltypes = defdict() native = False sortedblocks = utils.SortedMap(utils.dict_iteritems(interp.blocks)) fd = FunctionDescriptor(native, pymod, fname, doc, sortedblocks, typemap, restype, calltypes, args, kws) return fd
def _from_python_function(cls, interp, typemap, restype, calltypes, native, mangler=None): (qualname, unique_name, modname, doc, args, kws, func_globals) = cls._get_function_info(interp) sortedblocks = utils.SortedMap(utils.dict_iteritems(interp.blocks)) self = cls(native, modname, qualname, unique_name, doc, sortedblocks, typemap, restype, calltypes, args, kws, mangler=mangler, globals=func_globals) return self
def insert_class(self, cls, attrs): clsty = types.Object(cls) for name, vtype in utils.dict_iteritems(attrs): imp = python_attr_impl(clsty, name, vtype) self.attrs[imp.key] = imp
def inspect_types(self): for ver, res in utils.dict_iteritems(self.overloads): print("%s %s" % (self.py_func.__name__, ver)) print('-' * 80) print(res.type_annotation) print('=' * 80)
def run(self): for blkid, blk in utils.dict_iteritems(self.interp.blocks): self.run_block(blk)