| /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/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/arkguard/test/ut/utils/ |
| D | ScopeAnalyzer.spec.ts | 30 Scope, 81 it('is Global Scope', function () { 82 let curScope = new Scope('curScope', sourceFile, ScopeKind.GLOBAL); 86 it('is not Global Scope', function () { 87 let curScope = new Scope('curScope', sourceFile, ScopeKind.MODULE); 93 it('is Function Scope', function () { 94 let curScope = new Scope('curScope', sourceFile, ScopeKind.FUNCTION); 98 it('is not Function Scope', function () { 99 let curScope = new Scope('curScope', sourceFile, ScopeKind.MODULE); 105 it('is Class Scope', function () { [all …]
|
| /arkcompiler/ets_frontend/ets2panda/ast_verifier/ |
| D | checkScopeDeclaration.cpp | 19 #include "varbinder/scope.h" 36 auto const *const scope = var->GetScope(); in operator ()() local 37 if (scope == nullptr) { in operator ()() 42 return CheckScope(ctx, scope); in operator ()() 45 …ult CheckScopeDeclaration::CheckScope(CheckContext &ctx, varbinder::Scope const *const scope) const in CheckScope() 47 auto const *const node = scope->Node(); in CheckScope() 54 ctx.AddCheckMessage("NODE IS NOT SCOPE BEARER", *node, node->Start()); in CheckScope() 58 if (node->Scope() == scope) { in CheckScope() 62 if (node->Scope()->IsFunctionScope()) { in CheckScope() 63 auto const *const functionScope = node->Scope()->AsFunctionScope(); in CheckScope() [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/base/ |
| D | hoisting.cpp | 26 ASSERT(pg->Scope()->IsModuleScope()); in StoreModuleVarOrLocalVar() 27 auto *var = pg->Scope()->FindLocal(decl->Name()); in StoreModuleVarOrLocalVar() 42 auto *scope = pg->Scope(); in HoistVar() local 43 if (scope->IsGlobalScope()) { in HoistVar() 49 auto *funcScope = scope->EnclosingFunctionVariableScope(); in HoistVar() 51 if (scope->HasParamScope() && funcScope->ParamScope()->HasParam(decl->Name())) { in HoistVar() 55 binder::ScopeFindResult result(decl->Name(), scope, 0, var); in HoistVar() 68 const auto &internalName = scriptFunction->Scope()->InternalName(); in HoistFunction() 69 auto *scope = pg->Scope(); in HoistFunction() local 70 if (scope->IsGlobalScope()) { in HoistFunction() [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
|
| /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> 42 void LocalVariable::SetLexical(Scope *scope, util::PatchFix *patchFixHelper) in SetLexical() argument 48 VariableScope *varScope = scope->IsFunctionParamScope() ? in SetLexical() 49 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/arkguard/src/utils/ |
| D | ScopeAnalyzer.ts | 77 * kind of a scope 83 * A map used to track whether identifiers without symbols are in the top-level scope. 98 * type of scope 114 export function isGlobalScope(scope: Scope): boolean { 115 return scope.kind === ScopeKind.GLOBAL; 118 export function isFunctionScope(scope: Scope): boolean { 119 return scope.kind === ScopeKind.FUNCTION; 122 export function isClassScope(scope: Scope): boolean { 123 return scope.kind === ScopeKind.CLASS; 126 export function isInterfaceScope(scope: Scope): boolean { [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/runtime_core/static_core/runtime/tooling/inspector/types/ |
| D | scope.cpp | 16 #include "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 void Scope::Serialize(JsonObjectBuilder &builder) const in Serialize()
|
| /arkcompiler/ets_frontend/ets2panda/compiler/lowering/ets/ |
| D | capturedVariables.cpp | 25 static void AddScopes(ir::AstNode *node, std::set<varbinder::Scope *> &scopes) noexcept in AddScopes() 27 if (node->Scope()->IsFunctionScope()) { in AddScopes() 28 scopes.emplace(node->Scope()->AsFunctionScope()->ParamScope()); in AddScopes() 30 if (node->Scope()->IsCatchScope()) { in AddScopes() 31 scopes.emplace(node->Scope()->AsCatchScope()->ParamScope()); in AddScopes() 33 if (node->Scope()->IsLoopScope()) { in AddScopes() 34 scopes.emplace(node->Scope()->AsLoopScope()->DeclScope()); in AddScopes() 36 scopes.emplace(node->Scope()); in AddScopes() 39 static varbinder::Variable *FindVariable(ir::Identifier *ident, std::set<varbinder::Scope *> const … in FindVariable() 42 …// NOTE! For some unknown reasons :) variables exist in scope collections but are not set to iden… in FindVariable() [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 | 94 …variable declare like 'var ##var_1;' to nearest statements in namespace function or top level scope in AddVariableToNearestStatements() 95 …* Record the variable name and scope in tempVarDeclStatements_ and will push the VariableDeclarat… in AddVariableToNearestStatements() 98 auto currentScope = Scope(); in AddVariableToNearestStatements() 138 auto *scope = it.second; in PushVariablesToNearestStatements() local 139 if (scope == nullptr) { in PushVariablesToNearestStatements() 140 auto scopeCtx = binder::LexicalScope<binder::Scope>::Enter(Binder(), ast->Scope()); in PushVariablesToNearestStatements() 143 } else if (scope->IsFunctionScope() || scope->IsTSModuleScope()) { in PushVariablesToNearestStatements() 144 auto *body = scope->Node()->AsScriptFunction()->Body(); in PushVariablesToNearestStatements() 146 auto scopeCtx = binder::LexicalScope<binder::Scope>::Enter(Binder(), scope); in PushVariablesToNearestStatements() 153 binder::Scope *Transformer::FindExportVariableInTsModuleScope(util::StringView name) const in FindExportVariableInTsModuleScope() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/evaluate/ |
| D | irCheckHelper.cpp | 31 bool IrCheckHelper::CheckNewNode(ir::AstNode *node, varbinder::Scope *scope, ir::AstNode *parentCla… in CheckNewNode() argument 39 if (scope == nullptr) { in CheckNewNode() 40 scope = checker_->Scope(); in CheckNewNode() 43 recursiveDecls_.emplace_back(program, scope, parentClass, node); in CheckNewNode() 72 auto [program, scope, parent, node] = recursiveDecls_.front(); in CheckDecls() 74 …pers::DoScopedAction(checker_, varBinder_, program, scope, parent, [this, node = node, scope = sco… in CheckDecls() 75 varBinder_->ResolveReferencesForScope(node, scope); in CheckDecls() 88 auto [program, scope, parent, node] = *iter; in HandleCustomNodes() 89 helpers::DoScopedAction(checker_, varBinder_, program, scope, parent, in HandleCustomNodes()
|
| D | irCheckHelper.h | 36 class Scope; variable 49 ScopedAstNode(parser::Program *p, varbinder::Scope *s, ir::AstNode *parent, ir::AstNode *n) in ScopedAstNode() 50 : program(p), scope(s), parentClass(parent), node(n) in ScopedAstNode() 56 varbinder::Scope *scope {nullptr}; 69 * @brief Runs scope and type checks on the given IR node 71 * @param scope to which node is relative to - if null, current checker scope is taken. 74 * either it or `scope` must be non-null. 77 …bool CheckNewNode(ir::AstNode *node, varbinder::Scope *scope, ir::AstNode *parentClass, parser::Pr…
|
| /arkcompiler/ets_frontend/arkguard/src/transformers/rename/ |
| D | RenameIdentifierTransformer.ts | 74 Scope, 125 * 3. do scope analysis for identifier obfuscations 195 let rootScope: Scope = manager.getRootScope(); 198 … let renameProcessors: ((scope: Scope) => void)[] = [renameLabelsInScope, renameNamesInScope]; 229 * @param scope scope, such as global, module, function, block 232 function getMangledNamesInScope(scope: Scope, processors: ((scope: Scope) => void)[]): void { 234 process(scope); 238 while (scope.children.length > 0) { 239 subScope = scope.children.pop(); 245 // process symbols in scope, exclude property name. [all …]
|
| /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() 77 auto scopes = ArenaSet<varbinder::Scope *> {allocator->Adapter()}; in FindCaptured() 79 if (ast->IsScopeBearer() && ast->Scope() != nullptr) { in FindCaptured() 80 scopes.insert(ast->Scope()); in FindCaptured() 81 if (ast->Scope()->IsFunctionScope()) { in FindCaptured() 82 scopes.insert(ast->Scope()->AsFunctionScope()->ParamScope()); in FindCaptured() 87 scopes.insert(ast->Scope()->Parent()); in FindCaptured() 107 auto *scope = NearestScope(node->Parent()); in Recheck() local 108 auto bscope = varbinder::LexicalScope<varbinder::Scope>::Enter(varBinder, scope); in Recheck() [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/debugger/src/arkdb/ |
| D | layouts.py | 32 from .debug_types import DEFAULT_DEPTH, Frame, Paused, Scope 45 async def _add_rows(table: Table, scope: Scope): argument 47 f":red_triangle_pointed_down: [table.header]{scope.data.type_}[/table.header]", 48 Text(f"{scope.data.object_.description}", style="repr.str"), 50 props = await scope.mirror_variables() 74 for scope in frame.scopes(): 75 if (scopes is None or scope.data.type_ in scopes) and (scope.data.type_ not in skip_scopes): 76 await _add_rows(table, scope) 79 f":red_triangle_pointed_up: [table.header]{scope.data.type_}[/table.header]", 80 f"[repr.str]{scope.data.object_.description}[/repr.str]",
|
| /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…
|