def Bind(self, bind): tar = bind.target if Bindable.isLocalVar(tar): return external = has_extrinsic(CFunction, tar) and extrinsic(CFunction, tar) if not external: external = vat.orig_loc(tar).module not in env(EXGLOBAL).ownModules if external: env(IMPORTBINDS).add(tar)
def Lit(self, lit): m = match(lit.literal) if m('StrLit(_)'): v = GlobalVar() add_extrinsic(Name, v, '.LC%d' % (vat.orig_loc(lit).index,)) vat.set_orig(v, lit) env(EXGLOBAL).newDecls.lits.append(LitDecl(v, lit.literal)) expr = L.Bind(v) add_extrinsic(TypeOf, expr, TStr()) add_extrinsic(TypeOf, v, TStr()) return expr else: return lit
def orig_index(stmt): return vat.orig_loc(stmt).index