[Webkit-unassigned] [Bug 223533] New: Variable incorrectly hoisted when it has the same name as a parameter

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 19 13:29:36 PDT 2021


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

            Bug ID: 223533
           Summary: Variable incorrectly hoisted when it has the same name
                    as a parameter
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: martinbooth at fb.com

The following code prints undefined in the console:

async function test(a) {
  console.log(a);
  var a;
}

test("a");

It should print "a" to the console as it does in firefox and chrome.

In fact, if the function is not async it will print "a" as expected.

While I don't recommend writing code like this, this code was produced by our minifier and it did lead to the chat feature on our website being unavailable for all safari users. The code worked as expected on v8, therefore nothing was picked up by our tests.

-- 
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/20210319/8663cb7c/attachment-0001.htm>


More information about the webkit-unassigned mailing list