Lines Matching defs:pg
23 static void HoistVar(PandaGen *pg, varbinder::Variable *var, const varbinder::VarDecl *decl)
25 auto *scope = pg->Scope();
28 pg->LoadConst(decl->Node(), Constant::JS_UNDEFINED);
29 pg->StoreGlobalVar(decl->Node(), decl->Name());
35 pg->LoadConst(decl->Node(), Constant::JS_UNDEFINED);
36 pg->StoreAccToLexEnv(decl->Node(), result, true);
39 static void HoistFunction(PandaGen *pg, varbinder::Variable *var, const varbinder::FunctionDecl *decl)
42 auto *scope = pg->Scope();
47 pg->DefineFunction(decl->Node(), scriptFunction, internalName);
48 pg->StoreGlobalVar(decl->Node(), var->Declaration()->Name());
55 pg->DefineFunction(decl->Node(), scriptFunction, internalName);
56 pg->StoreAccToLexEnv(decl->Node(), result, true);
59 void Hoisting::Hoist(PandaGen *pg)
61 const auto *scope = pg->Scope();
72 HoistVar(pg, var, decl->AsVarDecl());
75 HoistFunction(pg, var, decl->AsFunctionDecl());