| /arkcompiler/runtime_core/static_core/plugins/ets/compiler/docs/ |
| D | interop_intrinsic_opt_doc.md | 4 Before the optimization, each call to Ecmascript method is enclosed by its own local scope (see [js… 10 …scope creations and destructions reduces time needed for GC to remove local objects. Also the foll… 23 ### Scope merging 26 * number of scope creations on any execution path is not increased *in most cases* 31 Scope merging is done in 3 stages, moving from more local to more global transforms. Number of obje… 33 …erop-try-single-scope` is enabled and there are no calls to non-interop methods, enclose the metho… 35 …ack current scope status (whether we are inside scope, after scope end or there were no scopes yet… 37 …scope switches (scope start or scope ends). If we remove these scope switches, blocks from `S` wil… 39 …h unique scope. We use a greedy approach and simply do not merge `S` with neighbouring scopes if e… 41 …scope which may start at several `CreateScope` intrinsics is bad for further optimization. Having … [all …]
|
| /arkcompiler/ets_frontend/arkguard/test/ut/utils/ |
| D | ScopeAnalyzer.spec.ts | 24 Scope, 61 it('is Global Scope', function () { 62 let curScope = new Scope('curScope', sourceFile, ScopeKind.GLOBAL); 66 it('is not Global Scope', function () { 67 let curScope = new Scope('curScope', sourceFile, ScopeKind.MODULE); 73 it('is Function Scope', function () { 74 let curScope = new Scope('curScope', sourceFile, ScopeKind.FUNCTION); 78 it('is not Function Scope', function () { 79 let curScope = new Scope('curScope', sourceFile, ScopeKind.MODULE); 85 it('is Class Scope', function () { [all …]
|
| /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() argument 79 … : scope_(NeedEnv(scope) ? scope : nullptr), regScope_(pg, scope), lexEnvCtx_(this, pg, 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() argument 85 : scope_(NeedEnv(scope) ? scope : nullptr), regScope_(pg), lexEnvCtx_(this, pg, target) in LoopEnvScope() 87 CopyBindings(pg, scope, varbinder::VariableFlags::PER_ITERATION); in LoopEnvScope() 90 explicit LoopEnvScope(PandaGen *pg, varbinder::LoopDeclarationScope *scope) in LoopEnvScope() argument [all …]
|
| D | moduleContext.cpp | 18 #include "varbinder/scope.h" 28 void CompileImports(PandaGen *pg, varbinder::ModuleScope *scope) in CompileImports() argument 30 for (const auto &[importDecl, decls] : scope->Imports()) { in CompileImports() 37 …varbinder::Variable *v = scope->FindLocal(decl->LocalName(), varbinder::ResolveBindingOptions::BIN… in CompileImports() 42 varbinder::ConstScopeFindResult result(decl->LocalName(), scope, 0, v); in CompileImports() 51 void CompileExports(PandaGen *pg, const varbinder::ModuleScope *scope) in CompileExports() argument 53 for (const auto &[exportDecl, decls] : scope->Exports()) { in CompileExports() 81 void ModuleContext::Compile(PandaGen *pg, varbinder::ModuleScope *scope) in Compile() argument 83 CompileImports(pg, scope); in Compile() 84 CompileExports(pg, scope); in Compile()
|
| /arkcompiler/ets_frontend/es2panda/compiler/base/ |
| D | hoisting.cpp | 19 #include <binder/scope.h> 30 ASSERT(pg->Scope()->IsModuleScope()); in StoreModuleVarOrLocalVar() 31 auto *var = pg->Scope()->FindLocal(decl->Name()); in StoreModuleVarOrLocalVar() 46 auto *scope = pg->Scope(); in HoistVar() local 47 if (scope->IsGlobalScope()) { in HoistVar() 53 auto *funcScope = scope->EnclosingFunctionVariableScope(); in HoistVar() 55 if (scope->HasParamScope() && funcScope->ParamScope()->HasParam(decl->Name())) { in HoistVar() 59 binder::ScopeFindResult result(decl->Name(), scope, 0, var); in HoistVar() 72 const auto &internalName = scriptFunction->Scope()->InternalName(); in HoistFunction() 73 auto *scope = pg->Scope(); in HoistFunction() local [all …]
|
| /arkcompiler/ets_frontend/ets2panda/varbinder/ |
| D | TypedBinder.cpp | 31 Scope *scope = nullptr; in BuildSignatureDeclarationBaseParams() local 35 scope = typeNode->AsETSFunctionType()->Scope(); in BuildSignatureDeclarationBaseParams() 39 scope = typeNode->AsTSFunctionType()->Scope(); in BuildSignatureDeclarationBaseParams() 43 scope = typeNode->AsTSConstructorType()->Scope(); in BuildSignatureDeclarationBaseParams() 47 scope = typeNode->AsTSSignatureDeclaration()->Scope(); in BuildSignatureDeclarationBaseParams() 51 scope = typeNode->AsTSMethodSignature()->Scope(); in BuildSignatureDeclarationBaseParams() 60 ASSERT(scope && scope->IsFunctionParamScope()); in BuildSignatureDeclarationBaseParams() 62 …auto scopeCtx = LexicalScope<FunctionParamScope>::Enter(this, scope->AsFunctionParamScope(), false… in BuildSignatureDeclarationBaseParams()
|
| D | variable.cpp | 19 #include "varbinder/scope.h" 46 void LocalVariable::SetLexical(Scope *scope) in SetLexical() argument 52 VariableScope *varScope = scope->EnclosingVariableScope(); in SetLexical() 57 void GlobalVariable::SetLexical([[maybe_unused]] Scope *scope) {} in SetLexical() argument 58 void ModuleVariable::SetLexical([[maybe_unused]] Scope *scope) {} in SetLexical() argument 59 void EnumVariable::SetLexical([[maybe_unused]] Scope *scope) {} in SetLexical() argument
|
| D | variable.h | 38 class Scope; variable 101 [[nodiscard]] Scope *GetScope() const noexcept in VARIABLE_TYPES() 111 void SetScope(varbinder::Scope *scope) noexcept in VARIABLE_TYPES() 113 scope_ = scope; in VARIABLE_TYPES() 143 virtual void SetLexical(Scope *scope) = 0; in VARIABLE_TYPES() 156 Scope *scope_ {}; in VARIABLE_TYPES() 198 void SetLexical([[maybe_unused]] Scope *scope) override; 214 void SetLexical([[maybe_unused]] Scope *scope) override; 246 void SetLexical([[maybe_unused]] Scope *scope) override; 287 void SetLexical([[maybe_unused]] Scope *scope) override;
|
| D | varbinder.cpp | 21 #include "varbinder/scope.h" 163 res.variable->SetLexical(res.scope); in LookupReference() 166 bool VarBinder::InstantiateArgumentsImpl(Scope **scope, Scope *iter, const ir::AstNode *node) in InstantiateArgumentsImpl() argument 172 …(*scope)->AddDecl<ConstDecl, LocalVariable>(Allocator(), FUNCTION_ARGUMENTS, VariableFlags::INITIA… in InstantiateArgumentsImpl() 178 *scope = iter->AsFunctionParamScope()->GetFunctionScope(); in InstantiateArgumentsImpl() 179 (*scope)->InsertBinding(argumentsVariable->Name(), argumentsVariable); in InstantiateArgumentsImpl() 182 (*scope)->AddFlag(ScopeFlags::USE_ARGS); in InstantiateArgumentsImpl() 190 Scope *scope = iter->IsFunctionParamScope() ? iter : iter->EnclosingVariableScope(); in InstantiateArguments() local 192 const auto *node = scope->Node(); in InstantiateArguments() 194 if (scope->IsLoopScope()) { in InstantiateArguments() [all …]
|
| /arkcompiler/ets_frontend/arkguard/src/utils/ |
| D | ScopeAnalyzer.ts | 70 * kind of a scope 78 * type of scope 94 export function isGlobalScope(scope: Scope): boolean { 95 return scope.kind === ScopeKind.GLOBAL; 98 export function isFunctionScope(scope: Scope): boolean { 99 return scope.kind === ScopeKind.FUNCTION; 102 export function isClassScope(scope: Scope): boolean { 103 return scope.kind === ScopeKind.CLASS; 106 export function isInterfaceScope(scope: Scope): boolean { 107 return scope.kind === ScopeKind.INTERFACE; [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/base/ |
| D | hoisting.cpp | 19 #include "varbinder/scope.h" 25 auto *scope = pg->Scope(); in HoistVar() local 27 if (scope->IsGlobalScope()) { in HoistVar() 33 varbinder::ConstScopeFindResult result(decl->Name(), scope, 0, var); in HoistVar() 42 auto *scope = pg->Scope(); in HoistFunction() local 44 const auto &internalName = scriptFunction->Scope()->InternalName(); in HoistFunction() 46 if (scope->IsGlobalScope()) { in HoistFunction() 52 …ASSERT(scope->IsFunctionScope() || scope->IsCatchScope() || scope->IsLocalScope() || scope->IsModu… in HoistFunction() 53 varbinder::ConstScopeFindResult result(decl->Name(), scope, 0, var); in HoistFunction() 61 const auto *scope = pg->Scope(); in Hoist() local [all …]
|
| /arkcompiler/ets_frontend/es2panda/binder/ |
| D | variable.cpp | 18 #include <binder/scope.h> 44 void LocalVariable::SetLexical(Scope *scope, util::PatchFix *patchFixHelper) in SetLexical() argument 50 VariableScope *varScope = scope->IsFunctionParamScope() ? in SetLexical() 51 scope->AsFunctionParamScope()->GetFunctionScope() : scope->EnclosingVariableScope(); in SetLexical() 81 void GlobalVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *pat… in SetLexical() argument 82 void ModuleVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *pat… in SetLexical() argument 83 void EnumVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *patch… in SetLexical() argument 84 void NamespaceVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *… in SetLexical() argument 85 void ImportEqualsVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFi… in SetLexical() argument 86 void EnumLiteralVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix… in SetLexical() argument
|
| D | variable.h | 35 class Scope; variable 124 virtual void SetLexical(Scope *scope, util::PatchFix *patchFixHelper = nullptr) = 0; in VARIABLE_TYPES() 167 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *patchFixHelper = n… 183 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *patchFixHelper = n… 195 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *patchFixHelper = n… 265 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *patchFixHelper = n… 283 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *patchFixHelper = n… 313 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *patchFixHelper = n… 347 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::PatchFix *patchFixHelper = n… 349 Scope *GetScope() in GetScope() [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/core/ |
| D | envScope.h | 19 #include <binder/scope.h> 36 explicit ScopeContext(PandaGen *pg, binder::Scope *newScope); 44 binder::Scope *prevScope_; 71 explicit VariableEnvScope(PandaGen *pg, binder::VariableScope *scope, LabelTarget target) in VariableEnvScope() argument 72 …: scope_(InitVariableContext(pg, scope) ? scope : nullptr), regScope_(pg, scope), lexEnvCtx_(this,… in VariableEnvScope() 81 binder::VariableScope *Scope() const in Scope() function 91 bool InitVariableContext(PandaGen *pg, binder::VariableScope *scope); 99 explicit LoopEnvScope(PandaGen *pg, binder::LoopScope *scope, LabelTarget target) in LoopEnvScope() argument 100 : VariableEnvScope(pg, scope, target) in LoopEnvScope() 104 explicit LoopEnvScope(PandaGen *pg, LabelTarget target, binder::LoopScope *scope) in LoopEnvScope() argument [all …]
|
| /arkcompiler/ets_frontend/ets2panda/checker/types/ts/ |
| D | enumLiteralType.h | 22 class Scope; variable 30 EnumLiteralType(util::StringView name, varbinder::Scope *scope, EnumLiteralTypeKind kind) in EnumLiteralType() argument 31 : Type(TypeFlag::ENUM_LITERAL), name_(name), scope_(scope), kind_(kind) in EnumLiteralType() 35 varbinder::Scope *Scope() in Scope() function 40 const varbinder::Scope *Scope() const in Scope() function 59 varbinder::Scope *scope_;
|
| /arkcompiler/ets_frontend/es2panda/typescript/types/ |
| D | enumLiteralType.h | 22 class Scope; variable 31 EnumLiteralType(util::StringView name, binder::Scope *scope, EnumLiteralTypeKind kind) in EnumLiteralType() argument 32 : Type(TypeFlag::ENUM_LITERAL), name_(name), scope_(scope), kind_(kind) in EnumLiteralType() 36 binder::Scope *Scope() in Scope() function 41 const binder::Scope *Scope() const in Scope() function 60 binder::Scope *scope_;
|
| /arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_ir/src/ |
| D | mir_scope.cpp | 22 // scp is a sub scope 26 // special case for function level scope which might not have range specified in IsSubScope() 53 // scope range of s1 and s2 may be completly same when macro calling macro expand 71 bool MIRScope::AddScope(MIRScope *scope) in AddScope() argument 73 // check first if it is valid with parent scope and sibling sub scopes in AddScope() 74 CHECK_FATAL(IsSubScope(scope), "<%s %s> is not a subscope of scope <%s %s>", in AddScope() 75 scope->GetRangeLow().DumpLocWithColToString().c_str(), in AddScope() 76 …scope->GetRangeHigh().DumpLocWithColToString().c_str(), GetRangeLow().DumpLocWithColToString().c_s… in AddScope() 79 if (!HasSameRange(s, scope) && HasJoinScope(s, scope)) { in AddScope() 81 scope->GetRangeLow().DumpLocWithColToString().c_str(), in AddScope() [all …]
|
| /arkcompiler/ets_frontend/es2panda/parser/transformer/ |
| D | transformer.h | 22 #include "binder/scope.h" 34 binder::Scope *scope; member 39 binder::Scope *scope; member 195 binder::Scope *FindExportVariableInTsModuleScope(util::StringView name) const; 196 …binder::Variable *FindTSModuleVariable(const ir::Expression *node, const binder::Scope *scope, boo… 200 …bool IsInstantiatedImportEquals(const ir::TSImportEqualsDeclaration *node, binder::Scope *scope) c… 221 bool IsStringInitForEnumMember(const ir::Expression *expr, binder::Scope *scope) const; 222 …bool IsStringForMemberExpression(const ir::MemberExpression *memberExpr, binder::Scope *scope) con… 225 binder::Scope *scope) const; 226 void FindLocalTSVariables(binder::Scope *scope, const util::StringView name, [all …]
|
| D | transformer.cpp | 20 #include "binder/scope.h" 105 …variable declare like 'var ##var_1;' to nearest statements in namespace function or top level scope in AddVariableToNearestStatements() 106 …* Record the variable name and scope in tempVarDeclStatements_ and will push the VariableDeclarat… in AddVariableToNearestStatements() 109 auto currentScope = Scope(); in AddVariableToNearestStatements() 149 auto *scope = it.second; in PushVariablesToNearestStatements() local 150 if (scope == nullptr) { in PushVariablesToNearestStatements() 151 auto scopeCtx = binder::LexicalScope<binder::Scope>::Enter(Binder(), ast->Scope()); in PushVariablesToNearestStatements() 154 } else if (scope->IsFunctionScope() || scope->IsTSModuleScope()) { in PushVariablesToNearestStatements() 155 auto *body = scope->Node()->AsScriptFunction()->Body(); in PushVariablesToNearestStatements() 157 auto scopeCtx = binder::LexicalScope<binder::Scope>::Enter(Binder(), scope); in PushVariablesToNearestStatements() [all …]
|
| /arkcompiler/runtime_core/static_core/runtime/tooling/inspector/types/ |
| D | scope.cpp | 16 #include "runtime/tooling/inspector/types/scope.h" 21 static const char *GetTypeString(Scope::Type type) in GetTypeString() 24 case Scope::Type::GLOBAL: in GetTypeString() 26 case Scope::Type::LOCAL: in GetTypeString() 34 Scope::Scope(Scope::Type type, RemoteObject object, std::optional<std::string> name) in Scope() function in ark::tooling::inspector::Scope 39 std::function<void(JsonObjectBuilder &)> Scope::ToJson() const in ToJson()
|
| /arkcompiler/ets_frontend/arkguard/src/transformers/rename/ |
| D | RenameIdentifierTransformer.ts | 68 Scope, 103 * 3. do scope analysis for identifier obfuscations 190 let root: Scope = manager.getRootScope(); 211 * @param scope scope, such as global, module, function, block 213 function renameInScope(scope: Scope): void { 214 // process labels in scope, the label can't rename as the name of top labels. 215 renameLabelsInScope(scope); 216 // process symbols in scope, exclude property name. 217 renameNamesInScope(scope); 220 while (scope.children.length > 0) { [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/07.overloading_and_overriding/03.overloading_for_functions/ |
| D | function_import_and_decl.params.yaml | 16 # import from a single file + declare in the current scope, overload-equivalent 21 # import from a single file + declare in the current scope, not overload-equivalent 26 # import from a single file + declare in the current scope, not overload-equivalent 31 # import from multiple files + declare in the current scope, overload-equivalent 37 # import from multiple files + declare in the current scope, not overload-equivalent 43 …# import from multiple files + declare in the current scope, overload-equivalent to the former imp… 49 …# import from multiple files + declare in the current scope, overload-equivalent to the latter imp…
|
| /arkcompiler/ets_frontend/ets2panda/compiler/lowering/ |
| D | util.cpp | 23 varbinder::Scope *NearestScope(const ir::AstNode *ast) in NearestScope() 29 return ast == nullptr ? nullptr : ast->Scope(); in NearestScope() 80 auto scopes = ArenaSet<varbinder::Scope *> {allocator->Adapter()}; in FindCaptured() 82 if (ast->IsScopeBearer() && ast->Scope() != nullptr) { in FindCaptured() 83 scopes.insert(ast->Scope()); in FindCaptured() 84 if (ast->Scope()->IsFunctionScope()) { in FindCaptured() 85 scopes.insert(ast->Scope()->AsFunctionScope()->ParamScope()); in FindCaptured() 90 scopes.insert(ast->Scope()->Parent()); in FindCaptured() 110 auto *scope = NearestScope(node); in Recheck() local 111 auto bscope = varbinder::LexicalScope<varbinder::Scope>::Enter(varBinder, scope); in Recheck() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/compiler/lowering/ets/ |
| D | boxingForLocals.cpp | 31 auto innermostArrowScopes = ArenaSet<varbinder::Scope *>(allocator->Adapter()); in FindCaptured() 32 innermostArrowScopes.insert(func->Scope()); in FindCaptured() 33 innermostArrowScopes.insert(func->Scope()->ParamScope()); in FindCaptured() 38 auto savedScopes = ArenaSet<varbinder::Scope *>(allocator->Adapter()); in FindCaptured() 51 innermostArrowScopes.insert(ast->Scope()); in FindCaptured() 52 if (ast->Scope()->IsFunctionScope()) { in FindCaptured() 53 innermostArrowScopes.insert(ast->Scope()->AsFunctionScope()->ParamScope()); in FindCaptured() 55 if (ast->Scope()->IsCatchScope()) { in FindCaptured() 56 innermostArrowScopes.insert(ast->Scope()->AsCatchScope()->ParamScope()); in FindCaptured() 58 if (ast->Scope()->IsLoopScope()) { in FindCaptured() [all …]
|
| /arkcompiler/ets_frontend/es2panda/ir/statements/ |
| D | blockStatement.h | 31 class Scope; variable 38 explicit BlockStatement(binder::Scope *scope, ArenaVector<Statement *> &&statementList) in BlockStatement() argument 39 … : Statement(AstNodeType::BLOCK_STATEMENT), scope_(scope), statements_(std::move(statementList)) in BlockStatement() 43 binder::Scope *Scope() const in Scope() function 62 binder::Scope *scope_;
|