Skip to content

Commit a7dd5fa

Browse files
jdaltonmarijnh
authored andcommitted
fix: add allowAwaitOutsideFunction check to parseForStatement
1 parent 18c5af7 commit a7dd5fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/statement.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pp.parseDoStatement = function(node) {
187187

188188
pp.parseForStatement = function(node) {
189189
this.next()
190-
let awaitAt = (this.options.ecmaVersion >= 9 && this.inAsync && this.eatContextual("await")) ? this.lastTokStart : -1
190+
let awaitAt = (this.options.ecmaVersion >= 9 && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction)) && this.eatContextual("await")) ? this.lastTokStart : -1
191191
this.labels.push(loopLabel)
192192
this.enterLexicalScope()
193193
this.expect(tt.parenL)

0 commit comments

Comments
 (0)