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

Issue 1414283002: [es6] Fix scoping for default parameters in arrow functions (Closed)

Created:
5 years, 2 months ago by adamk
Modified:
5 years, 2 months ago
Reviewers:
rossberg
CC:
v8-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[es6] Fix scoping for default parameters in arrow functions When eagerly parsing arrow functions, expressions in default parameter initializers are parsed in the enclosing scope, rather than in the function's scope (since that scope does not yet exist). This leads to VariableProxies being added to the wrong scope, and scope chains for FunctionLiterals being incorrect. This patch addresses these problems by adding a subclass of AstExpressionVisitor that moves VariableProxies to the proper scope and fixes up scope chains of FunctionLiterals. This is a revert of the revert https://crrev.com/e41614a058426fb6102e4ab2dd4f98997f00c0fc with a much-improved (though not yet perfect) Scope::ResetOuterScope method which properly fixes not only the outer_scope_ pointer but also fixes the inner_scope_ list in the relevant outer_scopes. More work likely still needs to be done to make this work completely, but it's very close to correct. BUG=v8:4395 LOG=y Committed: https://crrev.com/02e4d21f4ce799c7d4e3500fa2cf96fc447456ff Cr-Commit-Position: refs/heads/master@{#31435}

Patch Set 1 #

Patch Set 2 : Fix set_outer_scope #

Total comments: 2

Patch Set 3 : Reset -> replace #

Patch Set 4 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+266 lines, -19 lines) Patch
M BUILD.gn View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M src/ast-expression-visitor.h View 2 chunks +3 lines, -2 lines 0 comments Download
M src/ast-expression-visitor.cc View 1 2 3 3 chunks +31 lines, -5 lines 0 comments Download
A src/parameter-initializer-rewriter.h View 1 chunk +22 lines, -0 lines 0 comments Download
A src/parameter-initializer-rewriter.cc View 1 2 1 chunk +84 lines, -0 lines 0 comments Download
M src/parser.cc View 1 2 3 2 chunks +5 lines, -0 lines 0 comments Download
M src/pattern-rewriter.cc View 1 2 3 2 chunks +10 lines, -1 line 0 comments Download
M src/scopes.h View 1 2 3 chunks +22 lines, -1 line 0 comments Download
M src/scopes.cc View 1 2 4 chunks +14 lines, -8 lines 0 comments Download
A test/mjsunit/harmony/regress/regress-4395.js View 1 chunk +69 lines, -0 lines 0 comments Download
M tools/gyp/v8.gyp View 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 16 (8 generated)
adamk
Patch set 2 includes the fix for the failures on the waterfall.
5 years, 2 months ago (2015-10-20 21:28:36 UTC) #4
rossberg
lgtm https://codereview.chromium.org/1414283002/diff/20001/src/scopes.h File src/scopes.h (right): https://codereview.chromium.org/1414283002/diff/20001/src/scopes.h#newcode118 src/scopes.h:118: void ResetOuterScope(Scope* outer_scope); Nit: "Reset" is not very ...
5 years, 2 months ago (2015-10-21 10:46:59 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1414283002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1414283002/40001
5 years, 2 months ago (2015-10-21 10:58:34 UTC) #8
adamk
https://codereview.chromium.org/1414283002/diff/20001/src/scopes.h File src/scopes.h (right): https://codereview.chromium.org/1414283002/diff/20001/src/scopes.h#newcode118 src/scopes.h:118: void ResetOuterScope(Scope* outer_scope); On 2015/10/21 10:46:59, rossberg wrote: > ...
5 years, 2 months ago (2015-10-21 10:58:35 UTC) #9
commit-bot: I haz the power
Try jobs failed on following builders: v8_android_arm_compile_rel on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/builds/8989) v8_linux_arm64_rel on tryserver.v8 (JOB_FAILED, ...
5 years, 2 months ago (2015-10-21 10:59:35 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1414283002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1414283002/60001
5 years, 2 months ago (2015-10-21 11:09:07 UTC) #14
commit-bot: I haz the power
Committed patchset #4 (id:60001)
5 years, 2 months ago (2015-10-21 12:04:18 UTC) #15
commit-bot: I haz the power
5 years, 2 months ago (2015-10-21 12:04:31 UTC) #16
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/02e4d21f4ce799c7d4e3500fa2cf96fc447456ff
Cr-Commit-Position: refs/heads/master@{#31435}

Powered by Google App Engine
This is Rietveld 408576698