Bug 156146 - When assigning to a sloppy mode hoisting candidate we should bind both its local binding and its 'var' binding
Summary: When assigning to a sloppy mode hoisting candidate we should bind both its lo...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-03 11:20 PDT by Saam Barati
Modified: 2016-04-06 11:37 PDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2016-04-03 11:20:26 PDT
For example, this should work:
function foo() {
    assert(f === undefined);
    {
         assert(typeof f === "function")
         f = 42
         assert(f === 42);
         function f() { }
    }
    assert(f === 42);
}

We can't do this solely inside the bytecode generator. This requires some runtime support for the annoying dynamic cases, i.e:
function foo() {
    assert(f === undefined);
    {
        function f() { }
        with ({}) {
            assert(typeof f === "function")
            f = 42
            assert(f === 42);
        }
    }
    assert(f === 42);
}