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

Issue 1405313002: [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:
caitp (gmail), rossberg
CC:
v8-reviews_googlegroups.com, Dan Ehrenberg, wingo
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. 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/cf72aad39e51de9b7074ea039377c1812f4a2c6b Cr-Commit-Position: refs/heads/master@{#31402}

Patch Set 1 #

Total comments: 4

Patch Set 2 : A few fixes #

Patch Set 3 : Add a test #

Patch Set 4 : Rebased #

Patch Set 5 : Fix class literal handling #

Unified diffs Side-by-side diffs Delta from patch set Stats (+273 lines, -39 lines) Patch
M BUILD.gn View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M src/ast.h View 1 2 3 1 chunk +30 lines, -26 lines 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 4 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 3 4 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 2 chunks +10 lines, -1 line 0 comments Download
M src/preparser.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/scopes.h View 1 2 3 2 chunks +8 lines, -1 line 0 comments Download
M src/scopes.cc View 1 2 3 1 chunk +3 lines, -2 lines 0 comments Download
A test/mjsunit/harmony/regress/regress-4395.js View 1 2 3 4 1 chunk +69 lines, -0 lines 0 comments Download
M tools/gyp/v8.gyp View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 20 (3 generated)
adamk
This is still not perfect, but I finally got enough cleanup pushed for AstVIsitors that ...
5 years, 2 months ago (2015-10-16 08:18:33 UTC) #2
rossberg
lgtm https://codereview.chromium.org/1405313002/diff/1/src/ast-expression-visitor.cc File src/ast-expression-visitor.cc (right): https://codereview.chromium.org/1405313002/diff/1/src/ast-expression-visitor.cc#newcode346 src/ast-expression-visitor.cc:346: void AstExpressionVisitor::VisitClassLiteral(ClassLiteral* expr) { Oh, how did this ...
5 years, 2 months ago (2015-10-16 11:55:41 UTC) #3
adamk
https://codereview.chromium.org/1405313002/diff/1/src/ast-expression-visitor.cc File src/ast-expression-visitor.cc (right): https://codereview.chromium.org/1405313002/diff/1/src/ast-expression-visitor.cc#newcode346 src/ast-expression-visitor.cc:346: void AstExpressionVisitor::VisitClassLiteral(ClassLiteral* expr) { On 2015/10/16 11:55:41, rossberg wrote: ...
5 years, 2 months ago (2015-10-16 13:38:29 UTC) #4
adamk
Hmm, I think the strong mode failures are due to the poor class scoping, so ...
5 years, 2 months ago (2015-10-16 13:39:54 UTC) #5
adamk
Waiting on https://codereview.chromium.org/1413903002/ to fix class scoping (also may do a little more ClassLiteral cleanup ...
5 years, 2 months ago (2015-10-19 09:51:55 UTC) #6
caitp (gmail)
On 2015/10/19 09:51:55, adamk wrote: > Waiting on https://codereview.chromium.org/1413903002/ to fix class scoping > (also ...
5 years, 2 months ago (2015-10-19 12:37:39 UTC) #7
caitp (gmail)
On 2015/10/19 12:37:39, caitp wrote: > On 2015/10/19 09:51:55, adamk wrote: > > Waiting on ...
5 years, 2 months ago (2015-10-19 12:38:02 UTC) #8
adamk
On 2015/10/19 12:38:02, caitp wrote: > On 2015/10/19 12:37:39, caitp wrote: > > On 2015/10/19 ...
5 years, 2 months ago (2015-10-19 13:55:58 UTC) #9
caitp (gmail)
On 2015/10/19 13:55:58, adamk wrote: > On 2015/10/19 12:38:02, caitp wrote: > > On 2015/10/19 ...
5 years, 2 months ago (2015-10-19 13:58:07 UTC) #10
adamk
On 2015/10/19 13:58:07, caitp wrote: > On 2015/10/19 13:55:58, adamk wrote: > > On 2015/10/19 ...
5 years, 2 months ago (2015-10-19 14:09:07 UTC) #11
caitp (gmail)
On 2015/10/19 14:09:07, adamk wrote: > On 2015/10/19 13:58:07, caitp wrote: > > On 2015/10/19 ...
5 years, 2 months ago (2015-10-19 14:23:54 UTC) #12
adamk
Class literals should now be working properly. I suspect there are still problems here, but ...
5 years, 2 months ago (2015-10-20 08:17:36 UTC) #14
rossberg
lgtm
5 years, 2 months ago (2015-10-20 09:12:35 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1405313002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1405313002/80001
5 years, 2 months ago (2015-10-20 09:14:03 UTC) #17
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years, 2 months ago (2015-10-20 09:15:29 UTC) #18
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/cf72aad39e51de9b7074ea039377c1812f4a2c6b Cr-Commit-Position: refs/heads/master@{#31402}
5 years, 2 months ago (2015-10-20 09:15:45 UTC) #19
Benedikt Meurer
5 years, 2 months ago (2015-10-20 10:35:59 UTC) #20
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:80001) has been created in
https://codereview.chromium.org/1417463004/ by bmeurer@chromium.org.

The reason for reverting is: Breaks nosnap:
http://build.chromium.org/p/client.v8/builders/V8%20Linux%20-%20nosnap%20-%20....

Powered by Google App Engine
This is Rietveld 408576698