| /arkcompiler/ets_frontend/ets2panda/compiler/lowering/scopesInit/ |
| D | scopesInitPhase.cpp | 23 varbinder::LexicalScope<T> LexicalScopeCreateOrEnter(varbinder::VarBinder *varBinder, ir::AstNode *… in LexicalScopeCreateOrEnter() argument 26 return varbinder::LexicalScope<T>::Enter(varBinder, reinterpret_cast<T *>(ast->Scope())); in LexicalScopeCreateOrEnter() 28 return varbinder::LexicalScope<T>(varBinder); in LexicalScopeCreateOrEnter() 32 T *AddOrGetDecl(varbinder::VarBinder *varBinder, util::StringView name, ir::AstNode *ast, in AddOrGetDecl() argument 35 …if (auto *var = varBinder->GetScope()->FindLocal(name, varbinder::ResolveBindingOptions::BINDINGS); in AddOrGetDecl() 39 return varBinder->AddDecl<T>(pos, args...); in AddOrGetDecl() 45 program->VarBinder()->InitTopScope(); in Perform() 54 auto const *const curScope = VarBinder()->GetScope(); in VisitScriptFunction() 57 …curScope->Find(functionName, scriptFunction->IsStatic() ? varbinder::ResolveBindingOptions::ALL_ST… in VisitScriptFunction() 58 … : varbinder::ResolveBindingOptions::ALL_NON_STATIC); in VisitScriptFunction() [all …]
|
| D | savedBindingsCtx.h | 19 #include "varbinder/varbinder.h" 25 explicit SavedBindingsContext(varbinder::VarBinder *varbinder) in SavedBindingsContext() argument 26 : varbinder_(varbinder), savedBindings_(varbinder_->GetScope()->Bindings()) in SavedBindingsContext() 39 varbinder::VarBinder *VarBinder() const in VarBinder() function 44 const varbinder::Scope::VariableMap &SavedBindings() const in SavedBindings() 50 varbinder::VarBinder *varbinder_; 51 varbinder::Scope::VariableMap savedBindings_; 56 …explicit ExportDeclarationContext(varbinder::VarBinder *varbinder) : SavedBindingsContext(varbinde… in ExportDeclarationContext() argument 69 …explicit ImportDeclarationContext(varbinder::VarBinder *varbinder) : SavedBindingsContext(varbinde… in ImportDeclarationContext() argument
|
| D | savedBindingsCtx.cpp | 27 varbinder::ModuleScope::ImportDeclList declList(Allocator()->Adapter()); in BindImportDecl() 29 for (const auto &[name, variable] : VarBinder()->GetScope()->OrderedBindings(Allocator())) { in BindImportDecl() 37 VarBinder()->GetScope()->AsModuleScope()->AddImportDecl(importDecl, std::move(declList)); in BindImportDecl() 42 if (VarBinder() == nullptr) { in BindExportDecl() 46 varbinder::ModuleScope::ExportDeclList declList(Allocator()->Adapter()); in BindExportDecl() 52 if (VarBinder()->GetScope()->Bindings().size() == SavedBindings().size()) { in BindExportDecl() 54 … VarBinder()->AddDecl<varbinder::FunctionDecl>(rhs->Start(), VarBinder()->Allocator(), in BindExportDecl() 58 … VarBinder()->AddDecl<varbinder::ConstDecl>(rhs->Start(), util::StringView(DEFAULT_EXPORT)); in BindExportDecl() 63 for (const auto &[name, variable] : VarBinder()->GetScope()->Bindings()) { in BindExportDecl() 70 variable->AddFlag(varbinder::VariableFlags::LOCAL_EXPORT); in BindExportDecl() [all …]
|
| D | scopesInitPhase.h | 22 #include "varbinder/tsBinding.h" 23 #include "varbinder/ETSBinder.h" 122 varbinder::Scope *GetScope() in GetScope() 124 return VarBinder()->GetScope(); in GetScope() 147 [[nodiscard]] varbinder::VarBinder *VarBinder() const in VarBinder() function 149 return program_->VarBinder(); in VarBinder() 156 varbinder::FunctionParamScope *HandleFunctionSig(ir::TSTypeParameterDeclaration *typeParams, 163 void HandleBlockStmt(ir::BlockStatement *block, varbinder::Scope *scope); 166 …void HandleFor(varbinder::LoopDeclarationScope *declScope, varbinder::LoopScope *loopScope, ForT *… in HandleFor() 174 virtual varbinder::Decl *BindClassName(ir::ClassDefinition *classDef); [all …]
|
| /arkcompiler/ets_frontend/ets2panda/evaluate/ |
| D | varbinderScopes.h | 20 #include "varbinder/ETSBinder.h" 21 #include "varbinder/recordTable.h" 25 // This scope must be used before running VarBinder or Checker on nodes from another Program. 28 explicit ProgramScope(varbinder::ETSBinder *varBinder, parser::Program *program) in ProgramScope() argument 29 : varBinder_(varBinder), in ProgramScope() 30 prevProgram_(varBinder->Program()), in ProgramScope() 31 prevRecordTable_(varBinder->GetRecordTable()), in ProgramScope() 32 prevTopScope_(varBinder->TopScope()), in ProgramScope() 33 prevVarScope_(varBinder->VarScope()), in ProgramScope() 34 prevScope_(varBinder->GetScope()) in ProgramScope() [all …]
|
| D | helpers.h | 22 #include "varbinder/ETSBinder.h" 53 explicit SafeStateScope(checker::ETSChecker *checker, varbinder::ETSBinder *varBinder); 65 varbinder::ETSBinder *varBinder_ {nullptr}; 66 varbinder::Scope *checkerScope_ {nullptr}; 67 varbinder::GlobalScope *binderTopScope_ {nullptr}; 68 varbinder::VariableScope *binderVarScope_ {nullptr}; 69 varbinder::Scope *binderScope_ {nullptr}; 71 varbinder::RecordTable *recordTable_ {nullptr}; 131 void DoScopedAction(checker::ETSChecker *checker, varbinder::ETSBinder *varBinder, parser::Program … in DoScopedAction() argument 132 varbinder::Scope *scope, ir::AstNode *parentClass, F &&action) in DoScopedAction() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/lowering/ets/ |
| D | localClassLowering.h | 30 … ArenaSet<varbinder::Variable *> const &capturedVars, 31 … ArenaMap<varbinder::Variable *, varbinder::Variable *> &variableMap, 32 … ArenaMap<varbinder::Variable *, ir::ClassProperty *> &propertyMap); 35 ArenaSet<varbinder::Variable *> const &capturedVars, 36 … ArenaMap<varbinder::Variable *, varbinder::Variable *> &variableMap, 37 … ArenaMap<varbinder::Variable *, varbinder::Variable *> ¶meterMap); 40 …ir::ClassDefinition *classDef, ArenaMap<varbinder::Variable *, varbinder::Variable *> &variableMap… 43 … ArenaUnorderedMap<ir::ClassDefinition *, ArenaSet<varbinder::Variable *>> &capturedVarsMap, 46 …ir::ETSParameterExpression *CreateParam(checker::ETSChecker *const checker, varbinder::FunctionPar…
|
| D | localClassLowering.cpp | 18 #include "varbinder/ETSBinder.h" 28 static ir::ClassProperty *CreateCapturedField(checker::ETSChecker *checker, const varbinder::Variab… in CreateCapturedField() 29 varbinder::ClassScope *scope, size_t &idx, in CreateCapturedField() 33 auto *varBinder = checker->VarBinder(); in CreateCapturedField() local 36 …auto fieldCtx = varbinder::LexicalScope<varbinder::LocalScope>::Enter(varBinder, scope->InstanceFi… in CreateCapturedField() 50 auto [decl, var] = varBinder->NewVarDecl<varbinder::LetDecl>(pos, fieldIdent->Name()); in CreateCapturedField() 52 var->AddFlag(varbinder::VariableFlags::PROPERTY); in CreateCapturedField() 61 …*CreateCtorFieldInit(checker::ETSChecker *checker, util::StringView name, varbinder::Variable *var) in CreateCtorFieldInit() 82 …public_lib::Context *ctx, ir::ClassDefinition *classDef, ArenaSet<varbinder::Variable *> const &ca… in CreateClassPropertiesForCapturedVariables() 83 ArenaMap<varbinder::Variable *, varbinder::Variable *> &variableMap, in CreateClassPropertiesForCapturedVariables() [all …]
|
| D | boxingForLocals.cpp | 18 #include "varbinder/ETSBinder.h" 25 static ArenaSet<varbinder::Variable *> FindCaptured(public_lib::Context *ctx, ir::ScriptFunction *f… in FindCaptured() 28 auto captured = ArenaSet<varbinder::Variable *>(allocator->Adapter()); in FindCaptured() 31 auto innermostArrowScopes = ArenaSet<varbinder::Scope *>(allocator->Adapter()); in FindCaptured() 38 auto savedScopes = ArenaSet<varbinder::Scope *>(allocator->Adapter()); in FindCaptured() 78 auto varsToBox = ArenaSet<varbinder::Variable *>(allocator->Adapter()); in FindCaptured() 82 static ArenaSet<varbinder::Variable *> FindModified(public_lib::Context *ctx, ir::ScriptFunction *f… in FindModified() 85 auto modified = ArenaSet<varbinder::Variable *>(allocator->Adapter()); in FindModified() 93 var->AddFlag(varbinder::VariableFlags::INITIALIZED); in FindModified() 103 static ArenaSet<varbinder::Variable *> FindVariablesToBox(public_lib::Context *ctx, ir::ScriptFunct… in FindVariablesToBox() [all …]
|
| D | unionLowering.cpp | 17 #include "varbinder/variableFlags.h" 18 #include "varbinder/ETSBinder.h" 43 …:ClassDefinition *GetUnionFieldClass(checker::ETSChecker *checker, varbinder::VarBinder *varbinder) in GetUnionFieldClass() argument 47 varbinder::Variable *foundVar = nullptr; in GetUnionFieldClass() 49 … varbinder::ResolveBindingOptions::BINDINGS)) != nullptr) { in GetUnionFieldClass() 53 auto [decl, var] = varbinder->NewVarDecl<varbinder::ClassDecl>(ident->Start(), ident->Name()); in GetUnionFieldClass() 56 auto classCtx = varbinder::LexicalScope<varbinder::ClassScope>(varbinder); in GetUnionFieldClass() 67 varbinder->AsETSBinder()->BuildClassDefinition(classDef); in GetUnionFieldClass() 71 static varbinder::LocalVariable *CreateUnionFieldClassProperty(checker::ETSChecker *checker, in CreateUnionFieldClassProperty() 72 varbinder::VarBinder *varbinder, in CreateUnionFieldClassProperty() argument [all …]
|
| D | expandBrackets.cpp | 22 #include "varbinder/ETSBinder.h" 23 #include "varbinder/scope.h" 58 scope = checker->VarBinder()->VarScope() != nullptr ? checker->VarBinder()->VarScope() in ProcessNewArrayInstanceExpression() 59 : checker->VarBinder()->TopScope(); in ProcessNewArrayInstanceExpression() 61 …auto expressionCtx = varbinder::LexicalScope<varbinder::Scope>::Enter(checker->VarBinder(), scope); in ProcessNewArrayInstanceExpression() 75 InitScopesPhaseETS::RunExternalNode(blockExpression, checker->VarBinder()); in ProcessNewArrayInstanceExpression() 76 …checker->VarBinder()->AsETSBinder()->ResolveReferencesForScope(blockExpression, NearestScope(block… in ProcessNewArrayInstanceExpression() 90 scope = checker->VarBinder()->VarScope() != nullptr ? checker->VarBinder()->VarScope() in ProcessNewMultiDimArrayInstanceExpression() 91 : checker->VarBinder()->TopScope(); in ProcessNewMultiDimArrayInstanceExpression() 93 …auto expressionCtx = varbinder::LexicalScope<varbinder::Scope>::Enter(checker->VarBinder(), scope); in ProcessNewMultiDimArrayInstanceExpression() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/varbinder/ |
| D | varbinder.h | 19 #include "varbinder/scope.h" 20 #include "varbinder/variableFlags.h" 50 namespace ark::es2panda::varbinder { 53 class VarBinder { 55 …explicit VarBinder(ArenaAllocator *allocator) : allocator_(allocator), functionScopes_(allocator_-… in VarBinder() function 57 NO_COPY_SEMANTIC(VarBinder); 58 NO_MOVE_SEMANTIC(VarBinder); 59 virtual ~VarBinder() = default; 71 …std::tuple<T *, varbinder::Variable *> NewVarDecl(const lexer::SourcePosition &pos, Args &&...args… 242 void BuildForInOfLoop(varbinder::LoopScope *loopScope, ir::AstNode *left, ir::Expression *right, [all …]
|
| D | JSBinder.h | 19 #include "varbinder/varbinder.h" 21 namespace ark::es2panda::varbinder { 22 class JSBinder : public VarBinder { 24 explicit JSBinder(ArenaAllocator *allocator) : VarBinder(allocator) {} in JSBinder() 32 } // namespace ark::es2panda::varbinder
|
| D | ASBinder.h | 19 #include "varbinder/varbinder.h" 21 namespace ark::es2panda::varbinder { 22 class ASBinder : public VarBinder { 24 explicit ASBinder(ArenaAllocator *allocator) : VarBinder(allocator) {} in ASBinder() 44 } // namespace ark::es2panda::varbinder
|
| D | TypedBinder.h | 19 #include "varbinder/varbinder.h" 21 namespace ark::es2panda::varbinder { 22 class TypedBinder : public VarBinder { 24 explicit TypedBinder(ArenaAllocator *allocator) : VarBinder(allocator) {} in TypedBinder() 34 } // namespace ark::es2panda::varbinder
|
| D | varbinder.cpp | 16 #include "varbinder.h" 17 #include "varbinder/privateBinding.h" 20 #include "varbinder/scope.h" 21 #include "varbinder/tsBinding.h" 62 namespace ark::es2panda::varbinder { namespace 63 void VarBinder::InitTopScope() in InitTopScope() 75 std::tuple<ParameterDecl *, Variable *> VarBinder::AddParamDecl(ir::AstNode *param) in AddParamDecl() 87 void VarBinder::ThrowRedeclaration(const lexer::SourcePosition &pos, const util::StringView &name) … in ThrowRedeclaration() 94 void VarBinder::ThrowUnresolvableVariable(const lexer::SourcePosition &pos, const util::StringView … in ThrowUnresolvableVariable() 101 void VarBinder::ThrowUnresolvableType(const lexer::SourcePosition &pos, const util::StringView &nam… in ThrowUnresolvableType() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/parser/program/ |
| D | program.h | 24 #include "varbinder/varbinder.h" 34 namespace ark::es2panda::varbinder { 35 class VarBinder; variable 36 } // namespace ark::es2panda::varbinder 51 auto *varbinder = allocator->New<T>(allocator); in NewProgram() local 52 return Program(allocator, varbinder); in NewProgram() 55 Program(ArenaAllocator *allocator, varbinder::VarBinder *varbinder) in Program() argument 57 varbinder_(varbinder), in Program() 60 extension_(varbinder->Extension()), in Program() 80 const varbinder::VarBinder *VarBinder() const in VarBinder() function [all …]
|
| /arkcompiler/ets_frontend/ets2panda/checker/ |
| D | TSchecker.h | 20 #include "varbinder/enumMemberResult.h" 32 namespace ark::es2panda::varbinder { 33 class VarBinder; variable 40 } // namespace ark::es2panda::varbinder 256 …bool StartChecker([[maybe_unused]] varbinder::VarBinder *varbinder, const CompilerOptions &options… 280 bool IsVariableUsedInConditionBody(ir::AstNode *parent, varbinder::Variable *searchVar); 281 bool FindVariableInBinaryExpressionChain(ir::AstNode *parent, varbinder::Variable *searchVar); 282 bool IsVariableUsedInBinaryExpressionChain(ir::AstNode *parent, varbinder::Variable *searchVar); 292 void GetTypeVar(varbinder::Decl *decl); 293 void GetTypeParam(varbinder::Variable *var, varbinder::Decl *decl); [all …]
|
| D | JSchecker.cpp | 18 #include "varbinder/varbinder.h" 23 bool JSChecker::StartChecker([[maybe_unused]] varbinder::VarBinder *varbinder, const CompilerOption… in StartChecker() argument 25 Initialize(varbinder); in StartChecker() 26 varbinder->IdentifierAnalysis(); in StartChecker()
|
| /arkcompiler/ets_frontend/ets2panda/compiler/core/ |
| D | envScope.h | 19 #include "varbinder/scope.h" 35 explicit ScopeContext(CodeGen *cg, varbinder::Scope *newScope); 43 varbinder::Scope *prevScope_; 78 explicit LoopEnvScope(PandaGen *pg, varbinder::LoopScope *scope, LabelTarget target) in LoopEnvScope() 81 CopyBindings(pg, scope, varbinder::VariableFlags::PER_ITERATION); in LoopEnvScope() 84 explicit LoopEnvScope(PandaGen *pg, LabelTarget target, varbinder::LoopScope *scope) in LoopEnvScope() 87 CopyBindings(pg, scope, varbinder::VariableFlags::PER_ITERATION); in LoopEnvScope() 90 explicit LoopEnvScope(PandaGen *pg, varbinder::LoopDeclarationScope *scope) in LoopEnvScope() 93 CopyBindings(pg, scope, varbinder::VariableFlags::LOOP_DECL); 96 varbinder::VariableScope *Scope() const in Scope() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/test/unit/dynamic/ |
| D | dynamic_call_test.cpp | 38 …Allocator()->New<parser::Program>(Allocator(), Allocator()->New<varbinder::ETSBinder>(Allocator())… in ParseExpr() 39 program->VarBinder()->SetProgram(program); in ParseExpr() 40 program->VarBinder()->InitTopScope(); in ParseExpr() 82 …void AddDynImport(const char *specifierName, varbinder::ETSBinder *varbinder, ir::Identifier *node) in AddDynImport() argument 93 compiler::InitScopesPhaseETS::RunExternalNode(importDecl, varbinder); in AddDynImport() 94 varbinder->BuildImportDeclaration(importDecl); in AddDynImport() 95 auto var = varbinder->TopScope()->Find(specifierName); in AddDynImport() 118 auto varbinder = prog->VarBinder()->AsETSBinder(); in TEST_F() local 120 // With empty varbinder A is local variable in TEST_F() 121 auto [finalObj, callName] = checker::DynamicCall::ResolveCall(varbinder, obj); in TEST_F() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/lowering/ |
| D | util.h | 21 #include "varbinder/ETSBinder.h" 25 varbinder::Scope *NearestScope(const ir::AstNode *ast); 30 ArenaSet<varbinder::Variable *> FindCaptured(ArenaAllocator *allocator, ir::AstNode *scopeBearer) n… 32 // Rerun varbinder and checker on the node. 33 void Recheck(varbinder::ETSBinder *varBinder, checker::ETSChecker *checker, ir::AstNode *node); 35 // Note: run varbinder and checker on the new node generated in lowering phases 36 void CheckLoweredNode(varbinder::ETSBinder *varBinder, checker::ETSChecker *checker, ir::AstNode *n…
|
| D | util.cpp | 23 varbinder::Scope *NearestScope(const ir::AstNode *ast) in NearestScope() 74 ArenaSet<varbinder::Variable *> FindCaptured(ArenaAllocator *allocator, ir::AstNode *scopeBearer) n… in FindCaptured() 76 auto result = ArenaSet<varbinder::Variable *> {allocator->Adapter()}; in FindCaptured() 77 auto scopes = ArenaSet<varbinder::Scope *> {allocator->Adapter()}; in FindCaptured() 92 if (var == nullptr || !var->HasFlag(varbinder::VariableFlags::LOCAL)) { in FindCaptured() 104 // Rerun varbinder and checker on the node. 105 void Recheck(varbinder::ETSBinder *varBinder, checker::ETSChecker *checker, ir::AstNode *node) in Recheck() argument 108 auto bscope = varbinder::LexicalScope<varbinder::Scope>::Enter(varBinder, scope); in Recheck() 111 InitScopesPhaseETS::RunExternalNode(node, varBinder); in Recheck() 112 varBinder->ResolveReferencesForScopeWithContext(node, scope); in Recheck() [all …]
|
| D | resolveIdentifiers.cpp | 18 #include "varbinder/ETSBinder.h" 24 auto *varbinder = ctx->parserProgram->VarBinder()->AsETSBinder(); in Perform() local 27 std::cout << varbinder->Program()->Dump() << std::endl; in Perform() 31 varbinder->Program()->DumpSilent(); in Perform() 39 varbinder->SetGenStdLib(options.compilationMode == CompilationMode::GEN_STD_LIB); in Perform() 40 varbinder->IdentifierAnalysis(); in Perform()
|
| /arkcompiler/ets_frontend/ets2panda/checker/types/ts/ |
| D | enumType.h | 22 namespace ark::es2panda::varbinder { 24 } // namespace ark::es2panda::varbinder 29 EnumType(varbinder::Variable *enumLiteralVar, varbinder::EnumVariable *enumVar) in EnumType() 34 const varbinder::Variable *EnumLiteralVar() const in EnumLiteralVar() 39 const varbinder::EnumVariable *EnumVar() const in EnumVar() 51 varbinder::Variable *enumLiteralVar_; 52 varbinder::EnumVariable *enumVar_;
|