Skip to content

Commit cb7fb45

Browse files
committed
Fix async/generator scope tests
FIX: Fix a bug where a class field initialized to an async arrow function wouldn't allow await inside it. Same issue existed for generator arrow functions with yield. Issue #1030
1 parent 399de2d commit cb7fb45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

acorn/src/state.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ export class Parser {
9797
}
9898

9999
get inFunction() { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 }
100-
get inGenerator() { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentThisScope().inClassFieldInit }
101-
get inAsync() { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentThisScope().inClassFieldInit }
100+
get inGenerator() { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit }
101+
get inAsync() { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit }
102102
get allowSuper() {
103103
const {flags, inClassFieldInit} = this.currentThisScope()
104104
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit

0 commit comments

Comments
 (0)