| /arkcompiler/ets_frontend/ts2panda/tests/ |
| D | scope.test.ts | 24 } from "../src/scope"; 33 let scope = new GlobalScope(); variable 34 let variable = scope.add("x", VarDeclarationKind.NONE); 36 let { scope: sp, level: lv, v: outVariable } = scope.find("x"); variable 39 expect(sp).to.be.equal(scope); 43 let scope = new GlobalScope(); variable 44 let variable = scope.add("x", VarDeclarationKind.VAR); 46 let { scope: sp, level: lv, v: outVariable } = scope.find("x"); variable 49 expect(sp).to.be.equal(scope); 53 let scope = new GlobalScope(); variable [all …]
|
| /arkcompiler/ets_frontend/ts2panda/src/ |
| D | addVariable2Scope.ts | 30 Scope, 33 } from "./scope"; 70 function addInnerArgs(node: ts.Node, scope: VariableScope, enableTypeRecord: boolean): void { 72 scope.addParameter(MandatoryFuncObj, VarDeclarationKind.CONST, -1); 76 scope.addParameter("0newTarget", VarDeclarationKind.CONST, -1); 77 scope.addParameter("0this", VarDeclarationKind.CONST, 0); 79 scope.addParameter(MandatoryNewTarget, VarDeclarationKind.CONST, -1); 80 scope.addParameter(MandatoryThis, VarDeclarationKind.CONST, 0); 84 scope.addParameter("exports", VarDeclarationKind.LET, 1); 85 scope.addParameter("require", VarDeclarationKind.LET, 2); [all …]
|
| D | recorder.ts | 44 Scope, 47 } from "./scope"; 60 scope: Scope; property in Recorder 63 private scopeMap: Map<ts.Node, Scope> = new Map<ts.Node, Scope>(); 64 private hoistMap: Map<Scope, Decl[]> = new Map<Scope, Decl[]>(); 74 …constructor(node: ts.Node, scope: Scope, compilerDriver: CompilerDriver, recordType: boolean, isTs… 76 this.scope = scope; 87 this.setScopeMap(this.node, this.scope); 88 this.recordInfo(this.node, this.scope); 113 private recordInfo(node: ts.Node, scope: Scope) { [all …]
|
| D | hoisting.ts | 30 Scope, 33 } from "./scope"; 53 export function hoistVar(decl: VarDecl, scope: Scope, pandaGen: PandaGen) { 56 if (scope instanceof GlobalScope) { 59 } else if (scope instanceof FunctionScope || scope instanceof ModuleScope) { 60 let v: ModuleVariable = <ModuleVariable>(scope.findLocal(name)!); 65 pandaGen.storeAccToLexEnv(NodeKind.FirstNodeOfFunction, scope, 0, v, true); 68 throw new Error("Wrong scope to hoist"); 72 export function hoistFunction(decl: FuncDecl, scope: Scope, pandaGen: PandaGen, compiler: Compiler,… 77 if (scope instanceof GlobalScope) { [all …]
|
| D | scope.ts | 91 export abstract class Scope { class 92 protected debugTag = "scope"; 95 protected parent: Scope | undefined = undefined; 125 setParent(parentScope: Scope | undefined) { 129 getParent(): Scope | undefined { 133 getRootScope(): Scope { 134 let sp: Scope | undefined = this; 145 let sp: Scope | undefined = this; 158 let curScope: Scope | undefined = this; 171 let sp: Scope | undefined = this; [all …]
|
| D | lexicalBinder.ts | 23 Scope, 25 } from "./scope"; 48 resolveIdentReference(node: ts.Node, scope: Scope) { 51 let newScope = tmp ? tmp : scope; 138 lookUpLexicalReference(name: string, scope: Scope) { 139 let declPosInfo = scope.resolveDeclPos(name); 150 if (declPosInfo.scope instanceof GlobalScope) { 157 setMandatoryParamLexical(name: string, scope: VariableScope) { 158 if (ts.isArrowFunction(scope.getBindingNode())) { 162 let v = scope.findLocal(name); [all …]
|
| D | lexenv.ts | 34 import { Scope } from "./scope"; 43 scope: Scope; property in VariableAccessBase 46 constructor(scope: Scope, level: number, variable: Variable) { 48 this.scope = scope; 68 constructor(scope: Scope, level: number, variable: Variable) { 69 super(scope, level, variable); 115 …constructor(scope: Scope, level: number, variable: Variable, isDeclaration: boolean, node: ts.Node… 116 super(scope, level, variable);
|
| D | compilerDriver.ts | 42 Scope, 44 } from "./scope"; 60 readonly scope: Scope, 119 addCompilationUnit(decl: ts.FunctionLikeDeclaration, scope: Scope, recorder: Recorder): string { 122 new PendingCompilationUnit(decl, scope, internalName) 143 postOrderAnalysis(scope: GlobalScope): VariableScope[] { 147 stack.push(scope); 207 this.compileImpl(unit.decl, unit.scope, unit.internalName, recorder); 239 this.compileImpl(unit.decl, unit.scope, unit.internalName, recorder); 253 private compileImpl(node: ts.SourceFile | ts.FunctionLikeDeclaration, scope: Scope, [all …]
|
| D | syntaxCheckerForStrcitMode.ts | 22 import { ModuleScope, Scope } from "./scope"; 191 function checkImportDeclaration(node: ts.ImportDeclaration, scope: Scope) { 192 if (!(scope instanceof ModuleScope)) { 213 function checkExportAssignment(node: ts.ExportAssignment, scope: Scope) { 214 if (!(scope instanceof ModuleScope)) { 223 function checkExportDeclaration(node: ts.ExportDeclaration, scope: Scope) { 224 if (!(scope instanceof ModuleScope)) { 233 export function checkSyntaxErrorForStrictMode(node: ts.Node, scope: Scope) { 287 checkImportDeclaration(<ts.ImportDeclaration>node, scope); 290 checkExportAssignment(<ts.ExportAssignment>node, scope); [all …]
|
| D | debuginfo.ts | 29 import { Scope } from "./scope"; 137 private static scopeArray: Scope[] = []; 201 public static addScope(scope: Scope) { 202 DebugInfo.scopeArray.push(scope); 327 recordArray.forEach(scope => { 328 let name2variable = scope.getName2variable(); 337 variableInfo.setStart(scope.getScopeStartInsIdx()); 338 variableInfo.setLength(scope.getScopeEndInsIdx() - scope.getScopeStartInsIdx() + 1); 351 // clear scope array 374 public static addDebugIns(scope: Scope, pandaGen: PandaGen, isStart: 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 LoopEnvScope(PandaGen *pg, binder::LoopScope *scope, LabelTarget target) in LoopEnvScope() argument 72 … : scope_(NeedEnv(scope) ? scope : nullptr), regScope_(pg, scope), lexEnvCtx_(this, pg, target) in LoopEnvScope() 74 InitLoopContext(pg, scope); in LoopEnvScope() 77 explicit LoopEnvScope(PandaGen *pg, LabelTarget target, binder::LoopScope *scope) in LoopEnvScope() argument 78 : scope_(NeedEnv(scope) ? scope : nullptr), regScope_(pg), lexEnvCtx_(this, pg, target) in LoopEnvScope() 80 InitLoopContext(pg, scope); in LoopEnvScope() 83 binder::VariableScope *Scope() const in Scope() function [all …]
|
| /arkcompiler/ets_frontend/es2panda/compiler/base/ |
| D | hoisting.cpp | 20 #include <binder/scope.h> 29 ASSERT(pg->Scope()->IsModuleScope()); in StoreModuleVarOrLocalVar() 30 auto *var = pg->Scope()->FindLocal(decl->Name()); in StoreModuleVarOrLocalVar() 40 auto *scope = pg->Scope(); in HoistVar() local 42 if (scope->IsGlobalScope()) { in HoistVar() 48 auto *funcScope = scope->EnclosingFunctionVariableScope(); in HoistVar() 53 binder::ScopeFindResult result(decl->Name(), scope, 0, var); in HoistVar() 62 auto *scope = pg->Scope(); in HoistFunction() local 64 const auto &internalName = scriptFunction->Scope()->InternalName(); in HoistFunction() 66 if (scope->IsGlobalScope()) { in HoistFunction() [all …]
|
| /arkcompiler/ets_frontend/es2panda/binder/ |
| D | variable.cpp | 18 #include <binder/scope.h> 43 void LocalVariable::SetLexical(Scope *scope, util::Hotfix *hotfixHelper) in SetLexical() argument 49 VariableScope *varScope = scope->EnclosingVariableScope(); in SetLexical() 68 void GlobalVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfi… in SetLexical() argument 69 void ModuleVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfi… in SetLexical() argument 70 void EnumVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfixH… in SetLexical() argument 71 void NamespaceVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *ho… in SetLexical() argument 72 void ImportEqualsVariable::SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix … in SetLexical() argument
|
| D | variable.h | 35 class Scope; variable 116 virtual void SetLexical(Scope *scope, util::Hotfix *hotfixHelper = nullptr) = 0; in VARIABLE_TYPES() 159 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfixHelper = nullp… 175 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfixHelper = nullp… 187 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfixHelper = nullp… 237 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfixHelper = nullp… 253 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfixHelper = nullp… 278 …void SetLexical([[maybe_unused]] Scope *scope, [[maybe_unused]] util::Hotfix *hotfixHelper = nullp… 280 Scope *GetScope() in GetScope() 285 void SetScope(Scope *scope) in SetScope() argument [all …]
|
| D | binder.cpp | 19 #include <binder/scope.h> 211 res.variable->SetLexical(res.scope, program_->HotfixHelper()); in LookupReference() 218 Scope *scope = iter->IsFunctionParamScope() ? iter : iter->EnclosingVariableScope(); in InstantiateArguments() local 220 const auto *node = scope->Node(); in InstantiateArguments() 222 if (scope->IsLoopScope()) { in InstantiateArguments() 223 iter = scope->Parent(); in InstantiateArguments() 233 …scope->AddDecl<ConstDecl, LocalVariable>(Allocator(), FUNCTION_ARGUMENTS, VariableFlags::INITIALIZ… in InstantiateArguments() 240 scope = iter->AsFunctionParamScope()->GetFunctionScope(); in InstantiateArguments() 241 scope->Bindings().insert({argumentsVariable->Name(), argumentsVariable}); in InstantiateArguments() 244 scope->AsVariableScope()->AddFlag(VariableScopeFlags::USE_ARGS); in InstantiateArguments() [all …]
|
| D | scope.h | 39 class Scope; 143 …ScopeFindResult(util::StringView n, Scope *s, uint32_t l, Variable *v) : ScopeFindResult(n, s, l, … in ScopeFindResult() 144 …ScopeFindResult(Scope *s, uint32_t l, uint32_t ll, Variable *v) : scope(s), level(l), lexLevel(ll)… in ScopeFindResult() 145 ScopeFindResult(util::StringView n, Scope *s, uint32_t l, uint32_t ll, Variable *v, bool c) in ScopeFindResult() 146 : name(n), scope(s), level(l), lexLevel(ll), variable(v), crossConcurrent(c) in ScopeFindResult() 151 Scope *scope {}; 158 class Scope { 160 virtual ~Scope() = default; 161 NO_COPY_SEMANTIC(Scope); 162 NO_MOVE_SEMANTIC(Scope); [all …]
|
| /arkcompiler/ets_frontend/ts2panda/src/base/ |
| D | lexEnv.ts | 21 import { VariableScope } from "../scope"; 28 function createLexEnv(pandaGen: PandaGen, scope: VariableScope): IRNode[] { 29 let lexEnvVars = scope.getNumLexEnv(); 32 let lexVarInfo = scope.getLexVarInfo(); 46 let scope = pandaGen.getScope()!.getNearestVariableScope(); 49 if (!scope) { 50 throw new Error("pandagen must have one variable scope"); 53 if (scope.need2CreateLexEnv()) { 54 insns = createLexEnv(pandaGen, 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_frontend/es2panda/parser/transformer/ |
| D | transformer.h | 22 #include "binder/scope.h" 32 binder::Scope *scope; member 67 binder::Scope *FindExportVariableInTsModuleScope(util::StringView name) const; 68 binder::Variable *FindTSModuleVariable(const ir::Expression *node, binder::Scope *scope) const; 98 binder::Scope *Scope() const in Scope() function 108 util::StringView FindTSModuleNameByScope(binder::Scope *scope) const in FindTSModuleNameByScope() argument 111 if (it.scope == scope) { in FindTSModuleNameByScope()
|
| /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 60 binder::Scope *scope_;
|
| /arkcompiler/ets_frontend/es2panda/ir/ts/ |
| D | tsFunctionType.h | 22 class Scope; variable 40 explicit TSFunctionType(binder::Scope *scope, ArenaVector<Expression *> &¶ms, in TSFunctionType() argument 43 scope_(scope), in TSFunctionType() 50 binder::Scope *Scope() const in Scope() function 78 binder::Scope *scope_;
|
| D | tsSignatureDeclaration.h | 22 class Scope; variable 42 explicit TSSignatureDeclaration(binder::Scope *scope, TSSignatureDeclarationKind kind, in TSSignatureDeclaration() argument 46 scope_(scope), in TSSignatureDeclaration() 53 binder::Scope *Scope() const in Scope() function 85 binder::Scope *scope_;
|
| D | tsConstructorType.h | 22 class Scope; variable 40 explicit TSConstructorType(binder::Scope *scope, ArenaVector<Expression *> &¶ms, in TSConstructorType() argument 43 scope_(scope), in TSConstructorType() 51 binder::Scope *Scope() const in Scope() function 84 binder::Scope *scope_;
|
| D | tsMethodSignature.h | 22 class Scope; variable 40 …explicit TSMethodSignature(binder::Scope *scope, Expression *key, TSTypeParameterDeclaration *type… in TSMethodSignature() argument 44 scope_(scope), in TSMethodSignature() 54 binder::Scope *Scope() const in Scope() function 101 binder::Scope *scope_;
|
| /arkcompiler/runtime_core/verification/models/contexts_merge/ |
| D | check_set_intersection_as_lub.als | 86 -- Sig java_typing/Top scope <= 1 87 -- Sig java_typing/Bot scope <= 1 88 -- Sig java_typing/Object scope <= 1 89 -- Sig java_typing/NullType scope <= 1 90 -- Sig java_typing/Null scope <= 1 91 -- Sig java_typing/Type scope <= 8 92 -- Sig java_typing/Value scope <= 8 93 -- Sig java_typing/Register scope <= 8 94 -- Sig java_typing/Instance scope <= 7 95 -- Sig java_typing/Class scope <= 8 [all …]
|