Skip to content

Commit

Permalink
Fix tokenizing of regexps after .of
Browse files Browse the repository at this point in the history
Closes #727
  • Loading branch information
marijnh committed Sep 7, 2018
1 parent 832c308 commit 0c12f63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tokencontext.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ tt.star.updateContext = function(prevType) {

tt.name.updateContext = function(prevType) {
let allowed = false
if (this.options.ecmaVersion >= 6) {
if (this.options.ecmaVersion >= 6 && prevType != tt.dot) {
if (this.value === "of" && !this.exprAllowed ||
this.value === "yield" && this.inGeneratorContext())
allowed = true
Expand Down
2 changes: 2 additions & 0 deletions test/tests-harmony.js
Original file line number Diff line number Diff line change
Expand Up @@ -16241,3 +16241,5 @@ test('for ([...foo, bar].baz in qux);', {
testFail("var f;\nfunction f() {}", "Identifier 'f' has already been declared (2:9)", {ecmaVersion: 6, sourceType: "module"});

test("function f() { var x; function x() {} }", {}, {ecmaVersion: 6, sourceType: "module"})

test("a.of / 2", {}, {ecmaVersion: 6})

0 comments on commit 0c12f63

Please sign in to comment.