Bug 156146
Summary: | When assigning to a sloppy mode hoisting candidate we should bind both its local binding and its 'var' binding | ||
---|---|---|---|
Product: | WebKit | Reporter: | Saam Barati <saam> |
Component: | JavaScriptCore | Assignee: | Saam Barati <saam> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | benjamin, fpizlo, ggaren, gskachkov, keith_miller, mark.lam, msaboff, oliver, sukolsak, ysuzuki |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Saam Barati
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);
}
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |