Lines Matching defs:scope
21 #include "src/heap/parked-scope.h"
24 #include "src/logging/runtime-call-stats-scope.h"
26 #include "src/objects/scope-info.h"
299 if (IsStatic(scope()->GetReceiverScope()->function_kind())) {
599 DeclarationScope* scope = outer->AsDeclarationScope();
600 scope->set_start_position(0);
602 FunctionState function_state(&function_state_, &scope_, scope);
625 scope->set_is_async_module();
631 if (IsAsyncModule(scope->function_kind())) {
636 !module()->Validate(this->scope()->AsModuleScope(),
642 ParseWrapped(isolate, info, &body, scope, zone());
644 ParseREPLProgram(info, &body, scope);
648 this->scope()->SetLanguageMode(info->language_mode());
652 // The parser will peek but not consume EOS. Our scope logically goes all
654 scope->set_end_position(peek_position());
664 InsertSloppyBlockFunctionVarBindings(scope);
667 // conflicting var declarations with outer scope-info-backed scopes.
673 CheckConflictingVarDeclarations(scope);
687 scope, body, function_state.expected_property_count(), parameter_count);
754 // Set function and block state for the outer eval scope.
776 DeclarationScope* scope) {
786 this->scope()->SetLanguageMode(info->language_mode());
799 Rewriter::RewriteBody(info, scope, block->statements());
851 // scope mismatch, we will only deserialize up to the outer scope of
852 // the class scope, and regenerate the class scope during reparsing.
865 // If the class scope doesn't have an outer scope to deserialize, we need
866 // to finalize the script scope without using
905 // If the function skips the outer class and the outer scope is a class, the
906 // function is in heritage position. Otherwise the function scope's skip bit
907 // will be correctly inherited from the outer scope.
929 DeclarationScope* function_scope = result->scope();
986 // TODO(adamk): We should construct this scope from the ScopeInfo.
987 DeclarationScope* scope = NewFunctionScope(kind);
988 scope->set_has_checked_syntax(true);
992 SetLanguageMode(scope, info->language_mode());
994 scope->set_start_position(start_position);
995 ParserFormalParameters formals(scope);
999 // NewUnresolved references in current scope. Enter arrow function
1000 // scope for formal parameter parsing.
1001 BlockState inner_block_state(&scope_, scope);
1051 DCHECK_EQ(scope(), outer);
1102 // Insert a FunctionState with the closest outer Declaration scope
1131 // If the class scope was not optimized away, we know that it allocated
1139 ClassScope* reparsed_scope = literal->scope();
1188 DCHECK(scope()->is_module_scope());
1559 AcceptINScope scope(this, true);
1776 Variable* var = DeclareVariable(name, NORMAL_VARIABLE, mode, init, scope(),
1791 scope(), &was_added, pos, end_position());
1797 VariableMode mode, Scope* scope,
1801 scope, was_added, proxy->position(), kNoSourcePosition);
1808 Scope* scope, bool* was_added, int begin,
1811 if (mode == VariableMode::kVar && !scope->is_declaration_scope()) {
1812 DCHECK(scope->is_block_scope() || scope->is_with_scope());
1813 declaration = factory()->NewNestedVariableDeclaration(scope, begin);
1817 Declare(declaration, name, kind, mode, init, scope, was_added, begin, end);
1823 InitializationFlag init, Scope* scope, bool* was_added,
1827 scope->DeclareVariable(
1866 Declare(declaration, variable_name, kind, mode, kCreatedInitialized, scope(),
1909 // other functions are set up when entering the surrounding scope.
1957 Scope* scope) {
1958 // In order to get the CaseClauses to execute in their own lexical scope,
1959 // but without requiring downstream code to have special scope handling
1961 // { // To group the statements--harmless to evaluate Expression in scope
1963 // { // To give CaseClauses a scope
1967 DCHECK_NOT_NULL(scope);
1968 DCHECK(scope->is_block_scope());
1969 DCHECK_GE(switch_statement->position(), scope->start_position());
1970 DCHECK_LT(switch_statement->position(), scope->end_position());
1989 cases_block->set_scope(scope);
2021 void Parser::ReportVarRedeclarationIn(const AstRawString* name, Scope* scope) {
2022 for (Declaration* decl : *scope->declarations()) {
2049 statement = factory()->NewTryCatchStatement(try_block, catch_info.scope,
2061 try_block, catch_info.scope, catch_block, pos);
2131 function_state_->scope()->generator_object_var()));
2152 function_state_->scope()->generator_object_var());
2175 DCHECK_EQ(function_scope, scope());
2360 outer_block->set_scope(scope());
2603 parameters->scope->has_simple_parameters());
2610 function_state_->scope()->DeclareGeneratorObjectVar(
2660 // - The outer scope must allow lazy compilation of inner functions.
2738 DeclarationScope* scope = NewFunctionScope(kind, parse_zone);
2739 SetLanguageMode(scope, language_mode);
2741 scope->SetScopeName(function_name);
2748 scope->set_start_position(position());
2757 SkipFunction(function_name, kind, function_syntax_kind, scope,
2765 ParseFunction(&body, function_name, pos, kind, function_syntax_kind, scope,
2778 event_name, flags().script_id(), ms, scope->start_position(),
2779 scope->end_position(),
2794 language_mode = scope->language_mode();
2799 CheckStrictOctalLiteral(scope->start_position(), scope->end_position());
2808 function_name, scope, body, expected_property_count, num_parameters,
2940 DCHECK(scope()->is_function_scope());
2941 DCHECK_EQ(scope(), parameters.scope);
2946 factory()->NewVariableProxy(parameters.scope->parameter(index));
2952 factory()->NewVariableProxy(parameters.scope->parameter(index)),
2959 BlockState block_state(&scope_, scope()->AsDeclarationScope());
2970 Scope* catch_scope = NewScopeWithParent(scope(), CATCH_SCOPE);
2997 function_state_->scope()->generator_object_var()));
3021 function_state_->scope()->generator_object_var());
3026 return factory()->NewYield(yield_result, scope()->start_position(),
3103 AcceptINScope scope(this, true);
3113 void Parser::DeclareClassVariable(ClassScope* scope, const AstRawString* name,
3116 scope->SetScopeName(name);
3123 scope->DeclareClassVariable(ast_value_factory(), name, class_token_pos);
3125 scope->declarations()->Add(declaration);
3129 // TODO(gsathya): Ideally, this should just bypass scope analysis and
3139 Variable* Parser::CreatePrivateNameVariable(ClassScope* scope,
3149 scope->DeclarePrivateName(name, mode, is_static_flag, &was_added);
3158 void Parser::DeclarePublicClassField(ClassScope* scope,
3170 // We create a synthetic variable name here so that scope
3180 void Parser::DeclarePrivateClassMember(ClassScope* scope,
3195 scope, GetVariableMode(kind),
3235 const char* name, DeclarationScope* scope, Statement* initializer_stmt) {
3236 DCHECK(IsClassMembersInitializerFunction(scope->function_kind()));
3241 ast_value_factory()->GetOneByteString(name), scope, statements, 0, 0, 0,
3244 FunctionLiteral::kShouldEagerCompile, scope->start_position(), false,
3247 scope->SetScopeName(ast_value_factory()->GetOneByteString(name));
3321 Scope* inner_scope = inner_block->scope();
3344 void Parser::InsertSloppyBlockFunctionVarBindings(DeclarationScope* scope) {
3345 // For the outermost eval scope, we cannot hoist during parsing: let
3346 // declarations in the surrounding scope may prevent hoisting, but the
3349 if (scope->is_eval_scope() && scope->outer_scope() == original_scope_) {
3352 scope->HoistSloppyBlockFunctions(factory());
3438 // which need their end position set at the end of the script (the top scope
3450 // If the function skips the outer class and the outer scope is a class,
3451 // the function is in heritage position. Otherwise the function scope's
3452 // skip bit will be correctly inherited from the outer scope.
3533 void Parser::SetLanguageMode(Scope* scope, LanguageMode mode) {
3542 scope->SetLanguageMode(mode);
3550 DCHECK(scope()->is_declaration_scope());
3551 scope()->AsDeclarationScope()->set_is_asm_module();