Index: src/parsing/parser.cc |
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
index 2d08a2427e2f02e9ebdb28a3c5a5b9a62cd58803..ec10355d7bd859ba96f04fba6f0888f498c837f9 100644 |
--- a/src/parsing/parser.cc |
+++ b/src/parsing/parser.cc |
@@ -4124,22 +4124,11 @@ void ParserTraits::ParseArrowFunctionFormalParameters( |
} |
Expression* initializer = nullptr; |
- if (expr->IsVariableProxy()) { |
- // When the formal parameter was originally seen, it was parsed as a |
- // VariableProxy and recorded as unresolved in the scope. Here we undo that |
- // parse-time side-effect for parameters that are single-names (not |
- // patterns; for patterns that happens uniformly in |
- // PatternRewriter::VisitVariableProxy). |
- parser_->scope()->RemoveUnresolved(expr->AsVariableProxy()); |
- } else if (expr->IsAssignment()) { |
+ if (expr->IsAssignment()) { |
Assignment* assignment = expr->AsAssignment(); |
DCHECK(!assignment->is_compound()); |
initializer = assignment->value(); |
expr = assignment->target(); |
- |
- // TODO(adamk): Only call this if necessary. |
- RewriteParameterInitializerScope(parser_->stack_limit(), initializer, |
- parser_->scope(), parameters->scope); |
} |
AddFormalParameter(parameters, expr, initializer, end_pos, is_rest); |
@@ -4219,16 +4208,17 @@ DoExpression* Parser::ParseDoExpression(bool* ok) { |
return expr; |
} |
- |
void ParserTraits::ParseArrowFunctionFormalParameterList( |
ParserFormalParameters* parameters, Expression* expr, |
- const Scanner::Location& params_loc, |
- Scanner::Location* duplicate_loc, bool* ok) { |
+ const Scanner::Location& params_loc, Scanner::Location* duplicate_loc, |
+ Scope::Snapshot& scope_snapshot, bool* ok) { |
if (expr->IsEmptyParentheses()) return; |
ParseArrowFunctionFormalParameters(parameters, expr, params_loc.end_pos, |
CHECK_OK_VOID); |
+ scope_snapshot.Reparent(parameters->scope); |
+ |
if (parameters->Arity() > Code::kMaxArguments) { |
ReportMessageAt(params_loc, MessageTemplate::kMalformedArrowFunParamList); |
*ok = false; |