/arkcompiler/ets_frontend/ets2panda/compiler/base/ |
H A D | hoisting.cpp | 23 static void HoistVar(PandaGen *pg, varbinder::Variable *var, const varbinder::VarDecl *decl) in HoistVar() argument 28 pg->LoadConst(decl->Node(), Constant::JS_UNDEFINED); in HoistVar() 29 pg->StoreGlobalVar(decl->Node(), decl->Name()); in HoistVar() 33 varbinder::ConstScopeFindResult result(decl->Name(), scope, 0, var); in HoistVar() 35 pg->LoadConst(decl->Node(), Constant::JS_UNDEFINED); in HoistVar() 36 pg->StoreAccToLexEnv(decl->Node(), result, true); in HoistVar() 39 static void HoistFunction(PandaGen *pg, varbinder::Variable *var, const varbinder::FunctionDecl *decl) in HoistFunction() argument 41 const ir::ScriptFunction *scriptFunction = decl->Node()->AsScriptFunction(); in HoistFunction() 47 pg->DefineFunction(decl in HoistFunction() 69 const auto *decl = var->Declaration(); Hoist() local [all...] |
/arkcompiler/ets_frontend/es2panda/compiler/base/ |
H A D | hoisting.cpp | 27 static void StoreModuleVarOrLocalVar(PandaGen *pg, binder::ScopeFindResult &result, const binder::Decl *decl) in StoreModuleVarOrLocalVar() argument 29 if (decl->IsImportOrExportDecl()) { in StoreModuleVarOrLocalVar() 31 auto *var = pg->Scope()->FindLocal(decl->Name()); in StoreModuleVarOrLocalVar() 34 pg->StoreModuleVariable(decl->Node(), var->AsModuleVariable()); in StoreModuleVarOrLocalVar() 36 pg->StoreAccToLexEnv(decl->Node(), result, true); in StoreModuleVarOrLocalVar() 40 static void HoistVar(PandaGen *pg, binder::Variable *var, const binder::VarDecl *decl) in HoistVar() argument 42 if (decl->IsDeclare()) { in HoistVar() 48 pg->LoadConst(decl->Node(), Constant::JS_UNDEFINED); in HoistVar() 49 pg->StoreGlobalVar(decl->Node(), decl in HoistVar() 65 HoistFunction(PandaGen *pg, binder::Variable *var, const binder::FunctionDecl *decl) HoistFunction() argument 115 const auto *decl = var->Declaration(); Hoist() local [all...] |
H A D | lexenv.cpp | 52 auto decl = result.variable->Declaration(); in ExpandLoadLexVar() local 53 if (decl->IsSendableClassDecl()) { in ExpandLoadLexVar() 54 auto classDef = decl->Node()->AsClassDefinition(); in ExpandLoadLexVar() 69 if (decl->IsLetOrConstOrClassDecl()) { in ExpandLoadLexVar() 101 const auto *decl = result.variable->Declaration(); in ExpandStoreLexVar() local 103 if (decl->IsLetOrConstOrClassDecl() && !isDecl) { in ExpandStoreLexVar() 111 if (decl->IsConstDecl()) { in ExpandStoreLexVar()
|
/arkcompiler/ets_frontend/ets2panda/compiler/core/ |
H A D | moduleContext.cpp | 36 for (const auto *decl : decls) { in CompileImports() 37 varbinder::Variable *v = scope->FindLocal(decl->LocalName(), varbinder::ResolveBindingOptions::BINDINGS); in CompileImports() 40 ASSERT(decl->ImportName() == "*"); in CompileImports() 42 varbinder::ConstScopeFindResult result(decl->LocalName(), scope, 0, v); in CompileImports() 43 pg->StoreAccToLexEnv(decl->Node(), result, true); in CompileImports() 73 for (const auto *decl : decls) { in CompileExports() 74 pg->LoadAccumulator(decl->Node(), moduleReg); in CompileExports() 75 pg->LoadObjByName(decl->Node(), decl->LocalName()); in CompileExports() 76 pg->StoreModuleVar(decl in CompileExports() [all...] |
H A D | function.cpp | 197 void Function::CompileInstanceFields(PandaGen *pg, const ir::ScriptFunction *decl) in CompileInstanceFields() argument 199 const auto klass = util::Helpers::GetClassDefiniton(decl); in CompileInstanceFields() 205 pg->GetThis(decl); in CompileInstanceFields() 206 pg->StoreAccumulator(decl, thisReg); in CompileInstanceFields() 207 pg->GetFunctionObject(decl); in CompileInstanceFields() 208 pg->StoreAccumulator(decl, ctor); in CompileInstanceFields() 213 pg->ClassPrivateMethodOrAccessorAdd(decl, ctor, thisReg); in CompileInstanceFields() 227 const auto *decl = pg->RootNode()->AsScriptFunction(); in CompileFunction() local 229 if (decl->IsConstructor() && (util::Helpers::GetClassDefiniton(decl) in CompileFunction() [all...] |
H A D | ETSfunction.cpp | 151 if (const auto *decl = etsg->RootNode()->AsScriptFunction(); !decl->IsDeclare() && !decl->IsExternal()) { in CompileFunction() 152 if (auto *const body = decl->Body(); body != nullptr && body->IsBlockStatement()) { in CompileFunction()
|
/arkcompiler/ets_frontend/ets2panda/varbinder/ |
H A D | variable.cpp | 25 LocalVariable::LocalVariable(Decl *decl, VariableFlags flags) : Variable(decl, flags) in LocalVariable() argument 27 if (decl->IsConstDecl() || decl->IsReadonlyDecl()) { in LocalVariable() 39 LocalVariable *LocalVariable::Copy(ArenaAllocator *allocator, Decl *decl) const in Copy() 41 auto *var = allocator->New<LocalVariable>(decl, flags_); in Copy() 61 void EnumVariable::ResetDecl(Decl *decl) in ResetDecl() argument 63 decl_ = decl; in ResetDecl()
|
H A D | variable.h | 131 void Reset(Decl *decl, VariableFlags flags) noexcept 133 decl_ = decl; 146 explicit Variable(Decl *decl, VariableFlags flags) : decl_(decl), flags_(flags) {} in Variable() argument 161 explicit LocalVariable(Decl *decl, VariableFlags flags); 199 LocalVariable *Copy(ArenaAllocator *allocator, Decl *decl) const; 207 explicit GlobalVariable(Decl *decl, VariableFlags flags) : Variable(decl, flags) {} in GlobalVariable() argument 219 explicit ModuleVariable(Decl *decl, VariableFlags flags) : Variable(decl, flag argument 255 EnumVariable(Decl *decl, bool backReference = false) EnumVariable() argument [all...] |
H A D | varbinder.h | 364 T *decl = Allocator()->New<T>(std::forward<Args>(args)...); in AddTsDecl() local 366 if (scope_->AddTsDecl(Allocator(), decl, Extension()) != nullptr) { in AddTsDecl() 367 return decl; in AddTsDecl() 370 ThrowRedeclaration(pos, decl->Name()); in AddTsDecl() 376 T *decl = Allocator()->New<T>(std::forward<Args>(args)...); in AddDecl() local 378 if (scope_->AddDecl(Allocator(), decl, Extension()) != nullptr) { in AddDecl() 379 return decl; in AddDecl() 382 ThrowRedeclaration(pos, decl->Name()); in AddDecl() 388 T *decl = Allocator()->New<T>(std::forward<Args>(args)...); in NewVarDecl() local 389 varbinder::Variable *var = scope_->AddDecl(Allocator(), decl, Extensio in NewVarDecl() [all...] |
/arkcompiler/ets_frontend/es2panda/binder/ |
H A D | binder.h | 223 void ReplaceConstReferenceWithInitialization(const ir::Identifier *ident, const Decl *decl); 292 T *decl = Allocator()->New<T>(std::forward<Args>(args)...); in AddTsDecl() local 293 if (decl == nullptr) { in AddTsDecl() 294 throw Error(ErrorType::GENERIC, "Unsuccessful allocation in adding ts decl during binder"); in AddTsDecl() 296 decl->SetDeclare(isDeclare); in AddTsDecl() 298 if (scope_->AddTsDecl(Allocator(), decl, program_->Extension())) { in AddTsDecl() 299 AddDeclarationName(decl->Name()); in AddTsDecl() 300 return decl; in AddTsDecl() 303 ThrowRedeclaration(pos, decl->Name()); in AddTsDecl() 309 T *decl in AddTsDecl() local 327 T *decl = Allocator()->New<T>(std::forward<Args>(args)...); AddDecl() local 344 T *decl = Allocator()->New<T>(std::forward<Args>(args)...); AddDecl() local [all...] |
H A D | variable.h | 107 void Reset(Decl *decl, VariableFlags flags) in Reset() argument 109 decl_ = decl; in Reset() 127 explicit Variable(Decl *decl, VariableFlags flags) : decl_(decl), flags_(flags) {} in Variable() argument 136 explicit LocalVariable(Decl *decl, VariableFlags flags); 168 LocalVariable *Copy(ArenaAllocator *allocator, Decl *decl) const; 176 explicit GlobalVariable(Decl *decl, VariableFlags flags) : Variable(decl, flags) {} in GlobalVariable() argument 188 explicit ModuleVariable(Decl *decl, VariableFlags flags) : Variable(decl, flag argument 213 EnumVariable(Decl *decl, bool backReference = false) EnumVariable() argument 276 NamespaceVariable(Decl *decl, VariableFlags flags) NamespaceVariable() argument 306 EnumLiteralVariable(Decl *decl, VariableFlags flags) EnumLiteralVariable() argument 340 ImportEqualsVariable(Decl *decl, VariableFlags flags) ImportEqualsVariable() argument [all...] |
H A D | variable.cpp | 24 LocalVariable::LocalVariable(Decl *decl, VariableFlags flags) : Variable(decl, flags) in LocalVariable() argument 26 if (decl->IsConstDecl()) { in LocalVariable() 36 LocalVariable *LocalVariable::Copy(ArenaAllocator *allocator, Decl *decl) const in Copy() 38 auto *var = allocator->New<LocalVariable>(decl, flags_); in Copy() 88 void EnumVariable::ResetDecl(Decl *decl) in ResetDecl() argument 90 decl_ = decl; in ResetDecl()
|
H A D | scope.h | 309 bool AddDecl(ArenaAllocator *allocator, Decl *decl, [[maybe_unused]] ScriptExtension extension) in AddDecl() argument 311 CHECK_NOT_NULL(decl); in AddDecl() 312 decls_.push_back(decl); in AddDecl() 313 return AddBinding(allocator, FindLocal(decl->Name()), decl, extension); in AddDecl() 316 bool AddTsDecl(ArenaAllocator *allocator, Decl *decl, [[maybe_unused]] ScriptExtension extension) in AddTsDecl() argument 318 decls_.push_back(decl); in AddTsDecl() 319 return AddBinding(allocator, FindLocal(decl->Name(), ResolveBindingOptions::ALL), decl, extension); in AddTsDecl() 1257 auto decl in AddFunction() local 1294 auto decl = currentVariable->Declaration(); AddClass() local 1356 T *decl = allocator->New<T>(std::forward<Args>(args)...); NewDecl() local 1369 auto *decl = allocator->New<DeclType>(name); AddDecl() local 1384 auto *decl = allocator->New<DeclType>(name); CreateVar() local [all...] |
/arkcompiler/ets_frontend/ets2panda/checker/ts/ |
H A D | helpers.cpp | 357 void TSChecker::GetTypeVar(varbinder::Decl *decl) in GetTypeVar() argument 360 util::Helpers::FindAncestorGivenByType(decl->Node(), ir::AstNodeType::VARIABLE_DECLARATOR); in GetTypeVar() 371 void TSChecker::GetTypeParam(varbinder::Variable *var, varbinder::Decl *decl) in GetTypeParam() argument 373 ir::AstNode *declaration = FindAncestorUntilGivenType(decl->Node(), ir::AstNodeType::SCRIPT_FUNCTION); in GetTypeParam() 401 void TSChecker::GetTypeEnum(varbinder::Variable *var, varbinder::Decl *decl) in GetTypeEnum() argument 411 decl->Node()->Start()); in GetTypeEnum() 417 Type *TSChecker::GetDeclTsType(varbinder::Variable *var, varbinder::Decl *decl) in GetDeclTsType() argument 419 switch (decl->Type()) { in GetDeclTsType() 422 if (!decl->Node()->Parent()->IsTSTypeQuery()) { in GetDeclTsType() 424 decl in GetDeclTsType() 474 varbinder::Decl *decl = var->Declaration(); GetTypeOfVariable() local 527 varbinder::Decl *decl = var->Declaration(); GetTypeReferenceType() local [all...] |
/arkcompiler/ets_frontend/es2panda/compiler/core/ |
H A D | function.cpp | 173 static void CompileClassInitializer(PandaGen *pg, const ir::ScriptFunction *decl, bool isStatic) in CompileClassInitializer() argument 175 const auto *classDef = decl->Parent()->Parent()->Parent()->AsClassDefinition(); in CompileClassInitializer() 180 pg->GetThis(decl); in CompileClassInitializer() 181 pg->StoreAccumulator(decl, thisReg); in CompileClassInitializer() 220 const auto *decl = pg->RootNode()->AsScriptFunction(); in CompileFunction() local 222 if (decl->IsConstructor()) { in CompileFunction() 223 const auto *classDef = util::Helpers::GetClassDefiniton(decl); in CompileFunction() 228 pg->GetThis(decl); in CompileFunction() 229 pg->StoreAccumulator(decl, thisReg); in CompileFunction() 232 pg->LoadLexicalVar(decl, leve in CompileFunction() [all...] |
/arkcompiler/ets_frontend/es2panda/ir/module/ |
H A D | exportDefaultDeclaration.h | 34 explicit ExportDefaultDeclaration(AstNode *decl, bool exportEquals) in ExportDefaultDeclaration() argument 35 : Statement(AstNodeType::EXPORT_DEFAULT_DECLARATION), decl_(decl), exportEquals_(exportEquals) in ExportDefaultDeclaration() 49 void SetDecl(AstNode *decl) in SetDecl() argument 51 decl_ = decl; in SetDecl()
|
H A D | exportNamedDeclaration.h | 49 explicit ExportNamedDeclaration(Statement *decl, ArenaVector<ExportSpecifier *> &&specifiers) in ExportNamedDeclaration() argument 52 decl_(decl), in ExportNamedDeclaration() 69 void SetDecl(Statement *decl) in SetDecl() argument 71 decl_ = decl; in SetDecl()
|
/arkcompiler/ets_frontend/es2panda/typescript/core/ |
H A D | helpers.cpp | 365 const binder::Decl *decl = var->Declaration(); in GetTypeOfVariable() local 367 if (!typeStack_.insert(decl->Node()).second) { in GetTypeOfVariable() 371 decl->Node()->Start()); in GetTypeOfVariable() 374 switch (decl->Type()) { in GetTypeOfVariable() 377 if (!decl->Node()->Parent()->IsTSTypeQuery()) { in GetTypeOfVariable() 379 decl->Node()->Start()); in GetTypeOfVariable() 386 const ir::AstNode *declarator = FindAncestorGivenByType(decl->Node(), ir::AstNodeType::VARIABLE_DECLARATOR); in GetTypeOfVariable() 398 var->SetTsType(decl->Node()->AsTSPropertySignature()->TypeAnnotation()->AsTypeNode()->GetType(this)); in GetTypeOfVariable() 408 checker::ScopeContext scopeCtx(this, decl->Node()->AsScriptFunction()->Scope()); in GetTypeOfVariable() 409 InferFunctionDeclarationType(decl in GetTypeOfVariable() 508 binder::Decl *decl = var->Declaration(); GetTypeReferenceType() local [all...] |
/arkcompiler/ets_frontend/ets2panda/compiler/lowering/scopesInit/ |
H A D | scopesInitPhase.cpp | 228 auto [decl, var] = AddOrGetVarDecl(varDecl->Flag(), varDecl->Start(), binding); in VisitVariableDeclarator() 229 BindVarDecl(binding, init, decl, var); in VisitVariableDeclarator() 285 auto *decl = in VisitExportAllDeclaration() local 287 VarBinder()->GetScope()->AsModuleScope()->AddExportDecl(exportAllDecl, decl); in VisitExportAllDeclaration() 341 auto *decl = in VisitExportNamedDeclaration() local 344 exportDecls.push_back(decl); in VisitExportNamedDeclaration() 454 void ScopesInitPhase::BindVarDecl([[maybe_unused]] ir::Identifier *binding, ir::Expression *init, varbinder::Decl *decl, in BindVarDecl() argument 457 decl->BindNode(init); in BindVarDecl() 497 auto *decl = AddOrGetDecl<varbinder::VarDecl>(VarBinder(), name, moduleDecl, moduleDecl->Name()->Start(), name); in VisitTSModuleDeclaration() local 498 decl in VisitTSModuleDeclaration() 516 auto *decl = VarBinder()->AddTsDecl<varbinder::TypeAliasDecl>(id->Start(), tsBinding.View()); VisitTSTypeAliasDeclaration() local 578 auto *decl = AddOrGetDecl<varbinder::EnumDecl>(VarBinder(), name, enumMember, key->Start(), name); VisitTSEnumMember() local 611 auto decl = AddOrGetDecl<varbinder::TypeParameterDecl>(VarBinder(), name, typeParam, typeParam->Start(), name); VisitTSTypeParameter() local 775 BindVarDecl(ir::Identifier *binding, ir::Expression *init, varbinder::Decl *decl, varbinder::Variable *var) BindVarDecl() argument 1036 auto *decl = AddOrGetDecl<varbinder::InterfaceDecl>(VarBinder(), name, interfaceDecl, interfaceDecl->Start(), VisitTSInterfaceDeclaration() local 1049 auto *decl = AddOrGetDecl<varbinder::EnumLiteralDecl>(VarBinder(), name, enumDecl, enumDecl->Start(), name, VisitTSEnumDeclaration() local 1220 auto decl = AddOrGetDecl<varbinder::LabelDecl>(VarBinder(), label->Name(), stmt, label->Start(), label->Name()); AttachLabelToScope() local [all...] |
H A D | savedBindingsCtx.cpp | 49 auto *decl = exportDecl->AsExportDefaultDeclaration(); in BindExportDecl() local 50 auto *rhs = decl->Decl(); in BindExportDecl() 71 auto *decl = in BindExportDecl() local 73 declList.push_back(decl); in BindExportDecl()
|
/arkcompiler/ets_frontend/ets2panda/ir/module/ |
H A D | exportNamedDeclaration.h | 36 explicit ExportNamedDeclaration(ArenaAllocator *allocator, AstNode *decl, in ExportNamedDeclaration() argument 40 decl_(decl), in ExportNamedDeclaration() 45 explicit ExportNamedDeclaration(ArenaAllocator *allocator, AstNode *decl) in ExportNamedDeclaration() argument 48 decl_(decl), in ExportNamedDeclaration()
|
/arkcompiler/ets_frontend/es2panda/ir/expressions/ |
H A D | identifier.cpp | 88 const binder::Decl *decl = Variable()->Declaration(); in Check() local 90 if (decl->IsTypeAliasDecl() || decl->IsInterfaceDecl()) { in Check()
|
/arkcompiler/ets_frontend/ets2panda/util/ast-builders/ |
H A D | exportDefaultDeclarationBuilder.h | 29 ExportDefaultDeclarationBuilder &SetDeclaration(AstNode *decl) in SetDeclaration() argument 31 decl_ = decl; in SetDeclaration()
|
H A D | variableDeclarationBuilder.h | 38 VariableDeclarationBuilder &SetDeclare(bool decl) in SetDeclare() argument 40 declare_ = decl; in SetDeclare()
|
/arkcompiler/ets_frontend/es2panda/ir/statements/ |
H A D | variableDeclarator.cpp | 51 const ir::VariableDeclaration *decl = parent_->AsVariableDeclaration(); in Compile() local 52 if (decl->Declare()) { in Compile() 61 if (decl->Kind() == ir::VariableDeclaration::VariableDeclarationKind::VAR) { in Compile() 64 if (decl->Kind() == ir::VariableDeclaration::VariableDeclarationKind::LET && !decl->Parent()->IsCatchClause()) { in Compile()
|