def fake_pxd(root): for entry in root.scope.entries.values(): if not entry.in_cinclude: entry.defined_in_pxd = 1 if entry.name == entry.cname and entry.visibility != 'extern': # Always mangle non-extern cimported entries. entry.cname = entry.scope.mangle(Naming.func_prefix, entry.name) return StatListNode(root.pos, stats=[]), root.scope
def __init__(self, code, name="(tree fragment)", pxds={}, temps=[], pipeline=[], level=None, initial_pos=None): if isinstance(code, unicode): def fmt(x): return u"\n".join(strip_common_indent(x.split(u"\n"))) fmt_code = fmt(code) fmt_pxds = {} for key, value in pxds.iteritems(): fmt_pxds[key] = fmt(value) mod = t = parse_from_strings(name, fmt_code, fmt_pxds, level=level, initial_pos=initial_pos) if level is None: t = t.body # Make sure a StatListNode is at the top if not isinstance(t, StatListNode): t = StatListNode(pos=mod.pos, stats=[t]) for transform in pipeline: if transform is None: continue t = transform(t) self.root = t elif isinstance(code, Node): if pxds != {}: raise NotImplementedError() self.root = code else: raise ValueError( "Unrecognized code format (accepts unicode and Node)") self.temps = temps
def fake_pxd(root): for entry in root.scope.entries.values(): entry.defined_in_pxd = 1 return StatListNode(root.pos, stats=[]), root.scope