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 #
Messages
Total messages: 16 (8 generated)
|