Create parser plugin "topLevelAwait" (#10449)

* Create parser plugin "topLevelAwait"

* Update test262 whitelist

* Update ts typings

* Fix "sourceType: unambiguous" with TLA

* Ambiguous tokens after await

* Update await %x(0)

* typo [skip ci]

* Typo [skip ci]

Co-Authored-By: Brian Ng <bng412@gmail.com>
This commit is contained in:
Nicolò Ribaudo
2019-10-29 22:18:39 +01:00
committed by GitHub
parent 63f9a3c946
commit 143d159982
42 changed files with 2108 additions and 461 deletions

View File

@@ -495,11 +495,7 @@ export default class StatementParser extends ExpressionParser {
this.state.labels.push(loopLabel);
let awaitAt = -1;
if (
(this.scope.inAsync ||
(!this.scope.inFunction && this.options.allowAwaitOutsideFunction)) &&
this.eatContextual("await")
) {
if (this.isAwaitAllowed() && this.eatContextual("await")) {
awaitAt = this.state.lastTokStart;
}
this.scope.enter(SCOPE_OTHER);