Lines Matching refs:decl
27 static void StoreModuleVarOrLocalVar(PandaGen *pg, binder::ScopeFindResult &result, const binder::Decl *decl)
29 if (decl->IsImportOrExportDecl()) {
31 auto *var = pg->Scope()->FindLocal(decl->Name());
34 pg->StoreModuleVariable(decl->Node(), var->AsModuleVariable());
36 pg->StoreAccToLexEnv(decl->Node(), result, true);
40 static void HoistVar(PandaGen *pg, binder::Variable *var, const binder::VarDecl *decl)
42 if (decl->IsDeclare()) {
48 pg->LoadConst(decl->Node(), Constant::JS_UNDEFINED);
49 pg->StoreGlobalVar(decl->Node(), decl->Name());
55 if (scope->HasParamScope() && funcScope->ParamScope()->HasParam(decl->Name())) {
59 binder::ScopeFindResult result(decl->Name(), scope, 0, var);
61 pg->LoadConst(decl->Node(), Constant::JS_UNDEFINED);
62 StoreModuleVarOrLocalVar(pg, result, decl);
65 static void HoistFunction(PandaGen *pg, binder::Variable *var, const binder::FunctionDecl *decl)
67 const ir::ScriptFunction *scriptFunction = decl->Node()->AsScriptFunction();
75 pg->DefineFunction(decl->Node(), scriptFunction, internalName);
76 pg->StoreGlobalVar(decl->Node(), var->Declaration()->Name());
83 binder::ScopeFindResult result(decl->Name(), scope, 0, var);
85 pg->DefineFunction(decl->Node(), scriptFunction, internalName);
86 StoreModuleVarOrLocalVar(pg, result, decl);
115 const auto *decl = var->Declaration();
117 if (decl->IsVarDecl()) {
118 HoistVar(pg, var, decl->AsVarDecl());
120 ASSERT(decl->IsFunctionDecl());
121 HoistFunction(pg, var, decl->AsFunctionDecl());