Question: 'await' is a keyword?
Closed this issue · 3 comments
In ES2016 spec, await
is reserved as a keyword in Modules.
But this spec seems to not change Keywords/FutureReservedWords productions.
Is await
a keyword or not?
AFAIK, it's reserved so that in a future edition (like ES2017), when async function
lands, await
will be allowed at the top-level of ES modules.
await
is a keyword in Modules, so things like let await = 1
are always an error in Modules. For legacy reasons, await
must be allowed as an identifier in Scripts, so its keywordness is keyed off a grammar parameter that makes it a keyword in certain contexts (namely, async functions) and identifiers everywhere else. I might suggest that awiat
is more of a pseudo-keyword than an actual keyword.
Thank you for the answer!
Sorry, my question is about FutureReservedWord
production.
Even if this spec is applied, does await
still remain in FutureReservedWord
, or it will move into Keyword
production since await
keyword is used in this feature?
In the spec, await
remains in FutureReservedWord
.
I'd like to make sure.
Thank you.