Bug 176573

Summary: `async` should be able to be used as an imported binding name
Product: WebKit Reporter: Keanu Lee <webkit>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, caitp, cdumez, commit-queue, darin, fpizlo, gskachkov, jond, keith_miller, mark.lam, msaboff, ryanhaddad, saam, sam, simon.fraser, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Safari 10   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Archive of layout-test-results from ews112 for mac-elcapitan
none
Patch saam: review+

Description Keanu Lee 2017-09-07 17:39:46 PDT
According to JS spec (https://tc39.github.io/ecma262/#sec-reserved-words), `async` is not a reserved keyword and should be able to be used as an imported binding name. For example, the following should not throw:

    import * as async from "./client.js";


Repro: https://kindly-physician.glitch.me/ (works in Chrome)

Related: https://github.com/Polymer/polymer-modulizer/issues/197
Comment 1 Radar WebKit Bug Importer 2017-10-05 07:32:50 PDT
<rdar://problem/34833164>
Comment 2 Yusuke Suzuki 2017-10-05 19:01:32 PDT
Created attachment 322964 [details]
Patch

WIP: checking performance
Comment 3 Yusuke Suzuki 2017-10-05 19:22:58 PDT
                         baseline                  patched                                      

closure              0.54239+-0.00583          0.54187+-0.00837       
jquery               7.29268+-0.04093    ^     7.21285+-0.03484       ^ definitely 1.0111x faster

OK, performance is not a problem.
Comment 4 Yusuke Suzuki 2017-10-05 19:23:26 PDT
*** Bug 177986 has been marked as a duplicate of this bug. ***
Comment 5 Yusuke Suzuki 2017-10-05 19:39:15 PDT
Created attachment 322971 [details]
Patch
Comment 6 Caitlin Potter (:caitp) 2017-10-06 00:09:37 PDT
Per `https://tc39.github.io/ecma262/#prod-ImportedBinding`, isn't "await" always an invalid binding name in import declarations? Or am I mis-reading that notation?
Comment 7 Caitlin Potter (:caitp) 2017-10-06 00:30:54 PDT
(In reply to Caitlin Potter (:caitp) from comment #6)
> Per `https://tc39.github.io/ecma262/#prod-ImportedBinding`, isn't "await"
> always an invalid binding name in import declarations? Or am I mis-reading
> that notation?

Ok, I totally misread the title of this bug. Makes perfect sense for "async", nevermind me :)
Comment 8 Build Bot 2017-10-06 01:15:43 PDT
Comment on attachment 322971 [details]
Patch

Attachment 322971 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/4778645

New failing tests:
workers/wasm-long-compile.html
Comment 9 Build Bot 2017-10-06 01:15:44 PDT
Created attachment 322996 [details]
Archive of layout-test-results from ews112 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 10 Yusuke Suzuki 2017-10-06 08:20:39 PDT
(In reply to Caitlin Potter (:caitp) from comment #7)
> (In reply to Caitlin Potter (:caitp) from comment #6)
> > Per `https://tc39.github.io/ecma262/#prod-ImportedBinding`, isn't "await"
> > always an invalid binding name in import declarations? Or am I mis-reading
> > that notation?
> 
> Ok, I totally misread the title of this bug. Makes perfect sense for
> "async", nevermind me :)

np ;), this is for “async”.
Comment 11 Yusuke Suzuki 2017-10-06 23:01:54 PDT
(In reply to Build Bot from comment #8)
> Comment on attachment 322971 [details]
> Patch
> 
> Attachment 322971 [details] did not pass mac-debug-ews (mac):
> Output: http://webkit-queues.webkit.org/results/4778645
> 
> New failing tests:
> workers/wasm-long-compile.html

This is unrelated.
Comment 12 WebKit Commit Bot 2017-10-07 14:16:27 PDT
Comment on attachment 322971 [details]
Patch

Clearing flags on attachment: 322971

Committed r223022: <http://trac.webkit.org/changeset/223022>
Comment 13 WebKit Commit Bot 2017-10-07 14:16:29 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Ryan Haddad 2017-10-09 09:09:14 PDT
This change introduced 18 test262 failures. Here is the output for one of the tests:

test262.yaml/test262/test/language/expressions/async-arrow-function/escaped-async.js.default: Expected uncaught exception with name 'SyntaxError' but exception value is not instance of this exception class
test262.yaml/test262/test/language/expressions/async-arrow-function/escaped-async.js.default: Exception: Test262: This statement should not be evaluated.
test262.yaml/test262/test/language/expressions/async-arrow-function/escaped-async.js.default: ERROR: Unexpected exit code: 3
FAIL: test262.yaml/test262/test/language/expressions/async-arrow-function/escaped-async.js.default

https://build.webkit.org/builders/Apple%20El%20Capitan%20Debug%20Test262%20%28Tests%29/builds/3621
Comment 15 Ryan Haddad 2017-10-09 13:02:38 PDT
Reverted r223022 for reason:

This change introduced 18 test262 failures.

Committed r223062: <http://trac.webkit.org/changeset/223062>
Comment 16 Yusuke Suzuki 2017-10-09 18:12:59 PDT
Created attachment 323262 [details]
Patch
Comment 17 Yusuke Suzuki 2017-10-09 22:53:17 PDT
Committed r223124: <http://trac.webkit.org/changeset/223124>