• littledan's avatar
    Fix scopes for body of sloppy-mode for-in/of loop · d0618585
    littledan authored
    This patch fixes an obscure edge case for functions defined as the
    direct body of a for-of/for-in loop, such as the following:
    
     for (foo in []) function foo() { return foo; }
    
    Here, the first occurrence of foo should point to the outer scope;
    however, before this patch, it pointed to the inner foo in an
    invalid way which caused an assertion about the scope chain to fail.
    This patch fixes the scope chain by inserting an extra scope for
    the body of the loop, not including the header.
    
    BUG=chromium:542099
    LOG=N
    R=rossberg
    
    Review URL: https://codereview.chromium.org/1396663004
    
    Cr-Commit-Position: refs/heads/master@{#31268}
    d0618585
regress-542099.js 617 Bytes