[Webkit-unassigned] [Bug 179698] Sloppy mode function declaration in block unable to access lexical variable

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 16 17:15:31 PST 2017


https://bugs.webkit.org/show_bug.cgi?id=179698

--- Comment #1 from Saam Barati <sbarati at apple.com> ---
(In reply to Adam Klein from comment #0)
> Test case:
> 
> {
>   let a = 42;
>   function f() { return a }
>   print(f())
> }
> 
> This throws "ReferenceError: Can't find variable: a". If I run this in
> strict mode, it works as expected (printing 42).

We don't support this in global scope. We do support it inside functions and I believe eval. We still need to implement it for the global scope.

e.g, replace outer {} with function (and maybe eval) and it works.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171117/56a7733d/attachment.html>


More information about the webkit-unassigned mailing list