Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(811)

Unified Diff: src/parsing/parser.cc

Issue 2166023002: Rescope arrow-function parameter lists by moving the delta to the parameter scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove unresolved() again Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
« src/ast/scopes.cc ('K') | « src/parsing/parser.h ('k') | src/parsing/parser-base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698