Lines Matching defs:scope
24 #include "src/logging/runtime-call-stats-scope.h"
26 #include "src/parsing/expression-scope.h"
61 explicit FormalParametersBase(DeclarationScope* scope) : scope(scope) {}
77 DeclarationScope* scope;
84 // Stack-allocated scope to collect source ranges from the parser.
322 // BlockState and FunctionState implement the parser's scope stack.
323 // The parser's current scope is in scope_. BlockState and FunctionState
324 // constructors push on the scope stack and the destructors pop. They are also
328 BlockState(Scope** scope_stack, Scope* scope)
330 *scope_stack_ = scope;
434 DeclarationScope* scope);
437 DeclarationScope* scope() const { return scope_->AsDeclarationScope(); }
451 FunctionKind kind() const { return scope()->function_kind(); }
571 scope(nullptr) {}
574 Scope* scope;
775 return zone()->template New<DeclarationScope>(zone(), scope(), BLOCK_SCOPE);
791 Scope* scope = NewScope(BLOCK_SCOPE);
792 scope->set_is_block_scope_for_object_literal();
793 return scope;
797 return NewScopeWithParent(scope(), scope_type);
801 // should automatically use scope() as parent, and be fine with
804 // Must always use the specific constructors for the blocklisted scope
813 // Creates a function scope that always allocates in zone(). The function
814 // scope itself is either allocated in zone() or in target_zone if one is
821 parse_zone, scope(), FUNCTION_SCOPE, kind);
823 // Record presence of an inner function scope
834 return scope()->GetDeclarationScope();
837 return scope()->GetClosureScope();
846 return scope()->NewUnresolved(factory()->ast_node_factory(), name,
852 return scope()->NewUnresolved(factory()->ast_node_factory(), name,
1018 ExpressionT ParsePossibleDestructuringSubPattern(AccumulationScope* scope);
1048 return scope()->GetReceiverScope();
1050 LanguageMode language_mode() { return scope()->language_mode(); }
1052 LanguageMode old = scope()->language_mode();
1053 impl()->SetLanguageMode(scope(), old > mode ? old : mode);
1115 DeclarationScope* closure_scope = scope()->GetClosureScope();
1182 AccumulationScope* scope,
1235 void ParseAsyncFunctionBody(Scope* scope, StatementListT* body);
1278 // Check if the scope has conflicting var/let declarations from different
1284 // The var declarations are hoisted to the function scope, but originate from
1285 // a scope where the name has also been let bound or the var declaration is
1286 // hoisted over such a scope.
1287 void CheckConflictingVarDeclarations(DeclarationScope* scope) {
1290 Declaration* decl = scope->CheckConflictingVarDeclarations(
1328 // Parse a SubStatement in strict mode, or with an extra block scope in
1457 // forwards the information to scope.
1460 Scope* scope) {
1464 scope->RecordEvalCall();
1491 return scope()->AsModuleScope()->module();
1493 Scope* scope() const { return scope_; }
1559 Scope* original_scope_; // The top scope for the current parsing item.
1596 DeclarationScope* scope = nullptr;
1598 bool HasInitialState() const { return scope == nullptr; }
1601 scope = nullptr;
1627 DeclarationScope* scope)
1628 : BlockState(scope_stack, scope),
1633 scope_(scope),
1662 scope()->ShouldBanArguments())) {
1694 scope()->ShouldBanArguments())) {
1774 // analysing it's scope, meaning, we don't have a chance to
1780 PrivateNameScopeIterator private_name_scope_iter(scope());
1933 next_arrow_function_info_.scope = parsing_scope.ValidateAndCreateScope();
1983 next_arrow_function_info_.scope =
1987 Scope::Snapshot scope_snapshot(scope());
1995 AcceptINScope scope(this, true);
2001 next_arrow_function_info_.scope = maybe_arrow.ValidateAndCreateScope();
2002 scope_snapshot.Reparent(next_arrow_function_info_.scope);
2011 return ParseClassExpression(scope());
2035 AcceptINScope scope(this, true);
2158 AcceptINScope scope(this, true);
2179 AcceptINScope scope(this, true);
2300 AcceptINScope scope(this, true);
2313 AcceptINScope scope(this, true);
2527 AcceptINScope scope(this, true);
2567 // Each static block has its own var and lexical scope, so make a new var
2568 // block scope instead of using the synthetic members initializer function
2569 // scope.
2616 AcceptINScope scope(this, true);
2652 AcceptINScope scope(this, true);
2767 // If methods appear inside the object literal, we'll enter this scope.
2845 AcceptINScope scope(this, true);
2921 DeclarationScope* scope = next_arrow_function_info_.scope;
2922 scope->set_start_position(lhs_beg_pos);
2924 FormalParametersT parameters(scope);
2928 parameters.is_simple = scope->has_simple_parameters();
3165 AcceptINScope scope(this, true);
3430 Scope::Snapshot scope_snapshot(scope());
3437 next_arrow_function_info_.scope = maybe_arrow.ValidateAndCreateScope();
3438 scope_snapshot.Reparent(next_arrow_function_info_.scope);
3481 AcceptINScope scope(this, true);
3534 CheckPossibleEvalCall(result, is_optional, scope());
3725 AcceptINScope scope(this, true);
3754 DeclarationScope* scope = GetReceiverScope();
3755 FunctionKind kind = scope->function_kind();
3771 Scope* home_object_scope = scope->RecordSuperPropertyUsage();
3820 AcceptINScope scope(this, true);
3861 auto declaration_it = scope()->declarations()->end();
3883 auto declaration_end = scope()->declarations()->end();
3917 ParameterParsingScope scope(impl(), parameters);
3991 ? scope()
3992 : scope()->GetDeclarationScope();
4040 AcceptINScope scope(this, var_context != kForStatement);
4204 // a script scope, or the initial scope of eval or another function.
4206 (!scope()->is_declaration_scope() || scope()->is_module_scope())
4215 !scope()->is_declaration_scope() &&
4257 ExpressionT value = ParseClassLiteral(scope(), name, scanner()->location(),
4314 DeclarationScope* function_scope = parameters.scope;
4377 scope()->set_end_position(end_position());
4392 DCHECK_EQ(function_scope, scope());
4406 impl()->RecordBlockSourceRange(inner_block, scope()->end_position());
4526 FunctionKind kind = formal_parameters.scope->function_kind();
4540 formal_parameters.scope);
4546 DCHECK_EQ(scope(), formal_parameters.scope);
4567 formal_parameters.scope, &dummy_num_parameters,
4579 // Parse again in the outer scope, since the language mode may change.
4580 BlockState block_state(&scope_, scope()->outer_scope());
4585 DeclarationScope* function_scope = next_arrow_function_info_.scope;
4599 AcceptINScope scope(this, true);
4610 AcceptINScope scope(this, true);
4629 formal_parameters.scope->set_end_position(end_position());
4633 CheckStrictOctalLiteral(formal_parameters.scope->start_position(),
4640 impl()->EmptyIdentifierString(), formal_parameters.scope, body,
4645 formal_parameters.scope->start_position(), has_braces,
4650 formal_parameters.scope->start_position());
4656 Scope* scope = formal_parameters.scope;
4662 scope->start_position(), scope->end_position(), name,
4716 scope()->set_start_position(class_token_pos);
4720 ExpressionParsingScope scope(impl());
4722 scope.ValidateExpression();
4838 void ParserBase<Impl>::ParseAsyncFunctionBody(Scope* scope,
4848 scope->set_end_position(end_position());
4947 AcceptINScope scope(this, true);
5045 AccumulationScope* scope) {
5046 if (scope) scope->Accumulate();
5068 if (scope != nullptr) scope->ValidateExpression();
5139 if (!scope()->HasSimpleParameters()) {
5337 scope()->set_start_position(peek_position());
5352 scope()->set_end_position(end_pos);
5355 body->set_scope(scope()->FinalizeBlockScope());
5377 scope()->set_start_position(scanner()->location().beg_pos);
5381 scope()->set_end_position(end_position());
5382 block->set_scope(scope()->FinalizeBlockScope());
5394 // The scope of a var declared variable anywhere inside a function
5474 AcceptINScope scope(this, true);
5487 // scope. This way, we don't try to resolve it during the scope
5489 this->scope()->DeleteUnresolved(label);
5646 // have a varblock scope.
5814 scope()->set_start_position(switch_pos);
5815 scope()->SetNonlinear();
5854 scope()->set_end_position(end_pos);
5856 Scope* switch_scope = scope()->FinalizeBlockScope();
5899 catch_info.scope = NewScope(CATCH_SCOPE);
5900 catch_info.scope->set_start_position(scanner()->location().beg_pos);
5903 BlockState catch_block_state(&scope_, catch_info.scope);
5906 // Create a block scope to hold any lexical declarations created
5910 scope()->set_start_position(position());
5916 catch_info.scope, identifier);
5918 catch_info.variable = catch_info.scope->DeclareCatchVariableName(
5921 auto declaration_it = scope()->declarations()->end();
5928 auto declaration_end = scope()->declarations()->end();
5945 Scope* inner_scope = inner_block->scope();
5953 scope(), VariableMode::kVar);
5961 scope()->set_end_position(end_position());
5963 catch_block->set_scope(scope()->FinalizeBlockScope());
5967 catch_info.scope->set_end_position(end_position());
6012 // so create an in-between scope.
6014 scope()->set_start_position(position());
6022 // Create an inner block scope which will be the parent scope of scopes
6034 scope()->set_is_hidden();
6041 // Parse the remaining code in the inner block scope since the declaration
6042 // above was parsed there. We'll finalize the unnecessary outer block scope
6045 inner_block_scope->set_start_position(scope()->start_position());
6054 Scope* finalized = scope()->FinalizeBlockScope();
6069 own_labels, scope());
6083 AcceptINScope scope(this, false);
6164 AcceptINScope scope(this, true);
6194 scope()->set_end_position(end_position());
6195 body_block->set_scope(scope()->FinalizeBlockScope());
6207 scope()->set_end_position(end_position());
6208 init_block->set_scope(scope()->FinalizeBlockScope());
6227 AcceptINScope scope(this, true);
6254 // in a new scope.
6262 scope()->set_start_position(scanner()->location().beg_pos);
6266 scope()->set_end_position(end_position());
6269 scope()->set_end_position(end_position());
6272 scope()->set_is_hidden();
6281 Scope* for_scope = scope()->FinalizeBlockScope();
6349 // Create an in-between scope for let-bound iteration variables.
6354 scope()->set_start_position(scanner()->location().beg_pos);
6355 scope()->set_is_hidden();
6430 AcceptINScope scope(this, kAllowIn);
6439 scope()->set_start_position(scanner()->location().beg_pos);
6445 scope()->set_end_position(end_position());
6454 body_block->set_scope(scope()->FinalizeBlockScope());
6457 Scope* block_scope = scope()->FinalizeBlockScope();
6466 Scope* for_scope = scope()->FinalizeBlockScope();
6475 scope()->set_end_position(end_position());
6476 Scope* for_scope = scope()->FinalizeBlockScope();