• Home
  • Raw
  • Download

Lines Matching full:scope

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()
156 auto currentScope = Scope(); in FindExportVariableInTsModuleScope()
205 auto scope = FindEnumMemberScope(name); in VisitTSNode() local
206 if (scope) { in VisitTSNode()
207 return CreateMemberExpressionFromIdentifier(scope, ident); in VisitTSNode()
211 auto scope = FindExportVariableInTsModuleScope(name); in VisitTSNode() local
212 if (scope) { in VisitTSNode()
213 return CreateMemberExpressionFromIdentifier(scope, ident); in VisitTSNode()
313 ResetParentScope(res, Scope()); in VisitTSNode()
515 auto *scope = Scope(); in GetClassReference() local
516 while (scope != nullptr) { in GetClassReference()
517 auto *v = scope->FindLocal(name, binder::ResolveBindingOptions::BINDINGS); in GetClassReference()
528 scope = scope->Parent(); in GetClassReference()
689 … = binder::LexicalScope<binder::FunctionScope>::Enter(Binder(), node->Ctor()->Function()->Scope()); in VisitInstanceProperty()
712 ResetParentScopeForAstNode(assignment, Scope()); in VisitInstanceProperty()
907 auto *scope = Binder()->Allocator()->New<binder::FunctionScope>(Allocator(), paramScope); in AddMethodToClass() local
908 CHECK_NOT_NULL(scope); in AddMethodToClass()
909 paramScope->BindFunctionScope(scope); in AddMethodToClass()
910 auto *body = AllocNode<ir::BlockStatement>(scope, std::move(statements)); in AddMethodToClass()
911 auto *func = AllocNode<ir::ScriptFunction>(scope, std::move(params), nullptr, body, nullptr, in AddMethodToClass()
913 scope->BindNode(func); in AddMethodToClass()
914 scope->BindParamScope(paramScope); in AddMethodToClass()
1117 auto scopeCtx = binder::LexicalScope<binder::Scope>::Enter(Binder(), in VisitClassDeclaration()
1118 hasPrivateIdentifier ? staticBlock->GetBody()->Scope() : Scope()); in VisitClassDeclaration()
1243 … staticInitializer->Function()->Scope()); in CreateClassStaticBlock()
1625 if (!IsInstantiatedImportEquals(node, Scope())) { in VisitTsImportEqualsDeclaration()
1653 …::IsInstantiatedImportEquals(const ir::TSImportEqualsDeclaration *node, binder::Scope *scope) const in IsInstantiatedImportEquals()
1659 auto *var = FindTSModuleVariable(node->ModuleReference(), scope, &isType); in IsInstantiatedImportEquals()
1670 const binder::Scope *scope, in FindTSModuleVariable() argument
1678 auto *var = FindTSModuleVariable(tsQualifiedName->Left(), scope, isType); in FindTSModuleVariable()
1706 auto *currentScope = scope; in FindTSModuleVariable()
1743 binder::Variable *Transformer::FindTSVariable(const binder::Scope *scope, const util::StringView &n… in FindTSVariable() argument
1745 binder::Variable *res = scope->FindLocalTSVariable<type>(name); in FindTSVariable()
1746 if (res == nullptr && scope->IsTSModuleScope()) { in FindTSVariable()
1747 res = scope->AsTSModuleScope()->FindExportTSVariable<type>(name); in FindTSVariable()
1816 void Transformer::ResetParentScope(ir::UpdateNodes res, binder::Scope *parentScope) const in ResetParentScope()
1894 auto scope = node->AsTSModuleDeclaration()->Scope(); in GetParamName() local
1895 if (scope && !scope->HasVariableName(name)) { in GetParamName()
1900 auto scope = node->AsTSEnumDeclaration()->Scope(); in GetParamName() local
1901 if (scope && !scope->HasDeclarationName(name)) { in GetParamName()
1916 binder::FunctionScope *funcScope = node->Scope(); in CreateCallExpressionForTsModule()
1990 auto findRes = Scope()->FindLocal(name, binder::ResolveBindingOptions::BINDINGS); in VisitTsModuleDeclaration()
2015 …auto findRes = Scope()->FindLocal(name); // Find if the variable with the same name is already de… in VisitTsEnumDeclaration()
2030 … auto flag = Scope()->Parent() == nullptr ? VariableParsingFlags::VAR : VariableParsingFlags::LET; in CreateVariableDeclarationForTSEnumOrTSModule()
2055 binder::FunctionScope *funcScope = node->Scope(); in CreateCallExpressionForTsEnum()
2127 binder::Variable *enumVar = Scope()->AsTSEnumScope()->FindEnumMemberVariable(enumMemberName); in CreateTsEnumMember()
2132 isStringInit = IsStringInitForEnumMember(node->Init(), Scope()); in CreateTsEnumMember()
2231 bool Transformer::IsStringInitForEnumMember(const ir::Expression *expr, binder::Scope *scope) const in IsStringInitForEnumMember()
2247 ASSERT(scope && scope->IsTSEnumScope()); in IsStringInitForEnumMember()
2248 binder::Variable *v = scope->AsTSEnumScope()->FindEnumMemberVariable(identName); in IsStringInitForEnumMember()
2254 if (IsStringInitForEnumMember(initExpr, scope)) { in IsStringInitForEnumMember()
2266 return IsStringForMemberExpression(expr->AsMemberExpression(), scope); in IsStringInitForEnumMember()
2272 IsStringInitForEnumMember(right, scope) && IsStringInitForEnumMember(left, scope)) { in IsStringInitForEnumMember()
2284 …er::IsStringForMemberExpression(const ir::MemberExpression *memberExpr, binder::Scope *scope) const in IsStringForMemberExpression()
2305 …nder::Variable *> findRes = FindFrontIdentifierTSVariables(members.front()->AsIdentifier(), scope); in IsStringForMemberExpression()
2317 … binder::Scope *scope) const in FindFrontIdentifierTSVariables()
2322 while (scope != nullptr) { in FindFrontIdentifierTSVariables()
2324 if (scope->IsTSEnumScope()) { in FindFrontIdentifierTSVariables()
2325 v = scope->AsTSEnumScope()->FindEnumMemberVariable(name); in FindFrontIdentifierTSVariables()
2335 FindLocalTSVariables(scope, name, types, findRes); in FindFrontIdentifierTSVariables()
2337 if (scope->IsTSModuleScope()) { in FindFrontIdentifierTSVariables()
2338 FindExportTSVariables(scope, name, types, findRes); in FindFrontIdentifierTSVariables()
2346 v = scope->FindLocal(name); in FindFrontIdentifierTSVariables()
2348 … if (scope->IsTSModuleScope() || scope->IsTSEnumScope()) { // v may be converted from ts variable in FindFrontIdentifierTSVariables()
2349 v = scope->Parent()->FindLocal(name); in FindFrontIdentifierTSVariables()
2357 if (scope->IsTSModuleScope()) { in FindFrontIdentifierTSVariables()
2358 v = scope->AsTSModuleScope()->FindExportVariable(name); in FindFrontIdentifierTSVariables()
2364 if (scope->IsTSModuleScope() || scope->IsTSEnumScope()) { in FindFrontIdentifierTSVariables()
2365 scope = scope->Parent(); in FindFrontIdentifierTSVariables()
2367 scope = scope->Parent(); in FindFrontIdentifierTSVariables()
2387 void Transformer::FindLocalTSVariables(binder::Scope *scope, const util::StringView name, in FindLocalTSVariables() argument
2395 v = scope->FindLocalTSVariable<binder::TSBindingType::NAMESPACE>(name); in FindLocalTSVariables()
2402 v = scope->FindLocalTSVariable<binder::TSBindingType::ENUMLITERAL>(name); in FindLocalTSVariables()
2406 v = scope->FindLocalTSVariable<binder::TSBindingType::IMPORT_EQUALS>(name); in FindLocalTSVariables()
2409 Parent()->AsTSImportEqualsDeclaration(), scope)) { in FindLocalTSVariables()
2423 void Transformer::FindExportTSVariables(binder::Scope *scope, const util::StringView name, in FindExportTSVariables() argument
2431 … v = scope->AsTSModuleScope()->FindExportTSVariable<binder::TSBindingType::NAMESPACE>(name); in FindExportTSVariables()
2438 … v = scope->AsTSModuleScope()->FindExportTSVariable<binder::TSBindingType::ENUMLITERAL>(name); in FindExportTSVariables()
2442 … v = scope->AsTSModuleScope()->FindExportTSVariable<binder::TSBindingType::IMPORT_EQUALS>(name); in FindExportTSVariables()
2445 Parent()->AsTSImportEqualsDeclaration(), scope)) { in FindExportTSVariables()
2476 auto *scope = enumMemberVar->AsEnumVariable()->Declaration()-> in VerifyMemberExpressionDeque() local
2477 Node()->Parent()->AsTSEnumDeclaration()->Scope(); in VerifyMemberExpressionDeque()
2479 if (IsStringInitForEnumMember(initExpr, scope)) { in VerifyMemberExpressionDeque()
2572 binder::Scope *Transformer::FindEnumMemberScope(const util::StringView name) const in FindEnumMemberScope()
2575 auto scope = Scope(); in FindEnumMemberScope() local
2576 while (scope != nullptr) { in FindEnumMemberScope()
2577 if (scope->InLocalTSBindings(name)) { in FindEnumMemberScope()
2580 if (scope->IsTSModuleScope() && scope->AsTSModuleScope()->InExportBindings(name)) { in FindEnumMemberScope()
2583 if (scope->IsTSEnumScope() && scope->AsTSEnumScope()->FindEnumMemberVariable(name)) { in FindEnumMemberScope()
2584 return scope; in FindEnumMemberScope()
2586 if (scope->FindLocal(name)) { in FindEnumMemberScope()
2590 if (scope->IsTSModuleScope() || scope->IsTSEnumScope()) { in FindEnumMemberScope()
2591 scope = scope->Parent(); in FindEnumMemberScope()
2593 scope = scope->Parent(); in FindEnumMemberScope()
2599 ir::MemberExpression *Transformer::CreateMemberExpressionFromIdentifier(binder::Scope *scope, ir::I… in CreateMemberExpressionFromIdentifier() argument
2602 …auto moduleName = scope->IsTSEnumScope() ? FindTSEnumNameByScope(scope) : FindTSModuleNameByScope( in CreateMemberExpressionFromIdentifier()
2649 void Transformer::ResetParentScopeForAstNodes(const ir::AstNode *parent, binder::Scope *parentScope… in ResetParentScopeForAstNodes()
2654 void Transformer::ResetParentScopeForAstNode(ir::AstNode *childNode, binder::Scope *parentScope) co… in ResetParentScopeForAstNode()
2658 auto scope = childNode->AsScriptFunction()->Scope(); in ResetParentScopeForAstNode() local
2659 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2660 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2664 auto scope = childNode->AsCatchClause()->Scope(); in ResetParentScopeForAstNode() local
2665 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2666 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2670 auto scope = childNode->AsClassDefinition()->Scope(); in ResetParentScopeForAstNode() local
2671 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2672 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2676 auto scope = childNode->AsBlockStatement()->Scope(); in ResetParentScopeForAstNode() local
2677 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2678 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2682 auto scope = childNode->AsDoWhileStatement()->Scope(); in ResetParentScopeForAstNode() local
2683 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2684 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2688 auto scope = childNode->AsWhileStatement()->Scope(); in ResetParentScopeForAstNode() local
2689 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2690 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2694 auto scope = childNode->AsForInStatement()->Scope(); in ResetParentScopeForAstNode() local
2695 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2696 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2700 auto scope = childNode->AsForOfStatement()->Scope(); in ResetParentScopeForAstNode() local
2701 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2702 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2706 auto scope = childNode->AsForUpdateStatement()->Scope(); in ResetParentScopeForAstNode() local
2707 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2708 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2712 auto scope = childNode->AsSwitchStatement()->Scope(); in ResetParentScopeForAstNode() local
2713 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2714 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2718 auto scope = childNode->AsTSEnumDeclaration()->Scope(); in ResetParentScopeForAstNode() local
2719 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2720 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2724 auto scope = childNode->AsTSInterfaceDeclaration()->Scope(); in ResetParentScopeForAstNode() local
2725 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2726 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2730 auto scope = childNode->AsTSMethodSignature()->Scope(); in ResetParentScopeForAstNode() local
2731 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2732 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2736 auto scope = childNode->AsTSModuleDeclaration()->Scope(); in ResetParentScopeForAstNode() local
2737 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2738 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2742 auto scope = childNode->AsTSSignatureDeclaration()->Scope(); in ResetParentScopeForAstNode() local
2743 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2744 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2748 auto scope = childNode->AsTSTypeParameterDeclaration()->Scope(); in ResetParentScopeForAstNode() local
2749 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2750 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2754 auto scope = childNode->AsTSConstructorType()->Scope(); in ResetParentScopeForAstNode() local
2755 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2756 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2760 auto scope = childNode->AsTSFunctionType()->Scope(); in ResetParentScopeForAstNode() local
2761 ASSERT(scope != nullptr); in ResetParentScopeForAstNode()
2762 scope->SetParent(parentScope); in ResetParentScopeForAstNode()
2774 auto scope = Scope(); in IsValueReference() local
2775 ASSERT(scope != nullptr); in IsValueReference()
2779 if (scope->FindLocal(name, binder::ResolveBindingOptions::BINDINGS) != nullptr || in IsValueReference()
2780 scope->FindLocalTSVariable<binder::TSBindingType::ENUMLITERAL>(name) != nullptr) { in IsValueReference()
2786 var = scope->FindLocalTSVariable<binder::TSBindingType::NAMESPACE>(name); in IsValueReference()
2792 var = scope->FindLocalTSVariable<binder::TSBindingType::IMPORT_EQUALS>(name); in IsValueReference()
2795 return IsInstantiatedImportEquals(node, scope); in IsValueReference()