Skip to content

Commit

Permalink
Fix token context tracking for for/const/of
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Nov 5, 2018
1 parent 9fa23b2 commit 3df4763
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion acorn/src/tokencontext.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pp.braceIsBlock = function(prevType) {
return true
if (prevType === tt.braceL)
return parent === types.b_stat
if (prevType === tt._var || prevType === tt.name)
if (prevType === tt._var || prevType === tt._const || prevType === tt.name)
return false
return !this.exprAllowed
}
Expand Down
2 changes: 2 additions & 0 deletions test/tests-harmony.js
Original file line number Diff line number Diff line change
Expand Up @@ -16058,6 +16058,8 @@ test("for (var {a} of /b/) {}", {}, {ecmaVersion: 6})

test("for (let {a} of /b/) {}", {}, {ecmaVersion: 6})

test("for (const {a} of /b/) {}", {}, {ecmaVersion: 6})

test("function* bar() { yield /re/ }", {}, {ecmaVersion: 6})

test("function* bar() { yield class {} }", {}, {ecmaVersion: 6})
Expand Down

0 comments on commit 3df4763

Please sign in to comment.