You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Module code is source text that is code that is provided as a ModuleBody. It is the code that is directly evaluated when a module is initialized. The module code of a particular module does not include any source text that is parsed as part of a nested FunctionDeclaration, FunctionExpression, GeneratorDeclaration, GeneratorExpression, MethodDefinition, ArrowFunction, ClassDeclaration, or ClassExpression.
So the OP's playground example is definitely not allowed, but given the above quote I think the following is allowed in an ES6 module:
@yortus, await is a reserved whenever the syntactic goal symbol is Module which is when parsing the entire module script. Thus, await is never allowed as an identifier in a module. The Module goal symbol is a distinct concept from "module code". See 5.1.1.
@bterlson thanks for the clarification. So we are losing another identifier to keywordland 😞 Pity it couldn't be treated as a contextual keyword like async.
According to http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words
"await is only treated as a FutureReservedWord when Module is the goal symbol of the syntactic grammar."
This code should be illegal I think:
http://www.typescriptlang.org/play/#src=import%20'foo'%3B%0A%0Alet%20await%20%3D%203%3B
Came up when discussing TS semantics with @ajklein (v8 ES6 module expert).
The text was updated successfully, but these errors were encountered: