• adamk's avatar
    [es6] Fix scoping for default parameters in arrow functions · cf72aad3
    adamk authored
    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
    
    Review URL: https://codereview.chromium.org/1405313002
    
    Cr-Commit-Position: refs/heads/master@{#31402}
    cf72aad3
BUILD.gn 53.4 KB