| Index: src/parsing/parser.cc
|
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
|
| index 968c78e205df01e0dc581008535d60760dbbb781..7df0ba555b8143a4b1595e11dc782ebcb883a834 100644
|
| --- a/src/parsing/parser.cc
|
| +++ b/src/parsing/parser.cc
|
| @@ -2025,9 +2025,11 @@ VariableProxy* Parser::NewUnresolved(const AstRawString* name,
|
| // scope.
|
| // Let/const variables in harmony mode are always added to the immediately
|
| // enclosing scope.
|
| - return DeclarationScope(mode)->NewUnresolved(
|
| - factory(), name, Variable::NORMAL, scanner()->location().beg_pos,
|
| - scanner()->location().end_pos);
|
| + Scope* scope =
|
| + IsLexicalVariableMode(mode) ? scope_ : scope_->DeclarationScope();
|
| + return scope->NewUnresolved(factory(), name, Variable::NORMAL,
|
| + scanner()->location().beg_pos,
|
| + scanner()->location().end_pos);
|
| }
|
|
|
|
|
| @@ -2210,7 +2212,8 @@ Statement* Parser::ParseNativeDeclaration(bool* ok) {
|
| // isn't lazily compiled. The extension structures are only
|
| // accessible while parsing the first time not when reparsing
|
| // because of lazy compilation.
|
| - DeclarationScope(VAR)->ForceEagerCompilation();
|
| + // TODO(adamk): Should this be ClosureScope()?
|
| + scope_->DeclarationScope()->ForceEagerCompilation();
|
|
|
| // TODO(1240846): It's weird that native function declarations are
|
| // introduced dynamically when we meet their declarations, whereas
|
| @@ -2447,7 +2450,6 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context,
|
| // need initialization. 'var' declared bindings are always initialized
|
| // immediately by their declaration nodes.
|
| parsing_result->descriptor.needs_init = false;
|
| - parsing_result->descriptor.is_const = false;
|
| if (peek() == Token::VAR) {
|
| if (is_strong(language_mode())) {
|
| Scanner::Location location = scanner()->peek_location();
|
| @@ -2466,7 +2468,6 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context,
|
| DCHECK(var_context != kStatement);
|
| parsing_result->descriptor.mode = CONST;
|
| }
|
| - parsing_result->descriptor.is_const = true;
|
| parsing_result->descriptor.needs_init = true;
|
| } else if (peek() == Token::LET && allow_let()) {
|
| Consume(Token::LET);
|
| @@ -2477,8 +2478,6 @@ void Parser::ParseVariableDeclarations(VariableDeclarationContext var_context,
|
| UNREACHABLE(); // by current callers
|
| }
|
|
|
| - parsing_result->descriptor.declaration_scope =
|
| - DeclarationScope(parsing_result->descriptor.mode);
|
| parsing_result->descriptor.scope = scope_;
|
| parsing_result->descriptor.hoist_scope = nullptr;
|
|
|
| @@ -3161,11 +3160,9 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
|
| DeclarationDescriptor descriptor;
|
| descriptor.declaration_kind = DeclarationDescriptor::NORMAL;
|
| descriptor.parser = this;
|
| - descriptor.declaration_scope = scope_;
|
| descriptor.scope = scope_;
|
| descriptor.hoist_scope = nullptr;
|
| descriptor.mode = LET;
|
| - descriptor.is_const = false;
|
| descriptor.needs_init = true;
|
| descriptor.declaration_pos = pattern->position();
|
| descriptor.initialization_pos = pattern->position();
|
| @@ -4536,11 +4533,9 @@ Block* Parser::BuildParameterInitializationBlock(
|
| DeclarationDescriptor descriptor;
|
| descriptor.declaration_kind = DeclarationDescriptor::PARAMETER;
|
| descriptor.parser = this;
|
| - descriptor.declaration_scope = scope_;
|
| descriptor.scope = scope_;
|
| descriptor.hoist_scope = nullptr;
|
| descriptor.mode = LET;
|
| - descriptor.is_const = false;
|
| descriptor.needs_init = true;
|
| descriptor.declaration_pos = parameter.pattern->position();
|
| // The position that will be used by the AssignmentExpression
|
|
|