Skip to content

Commit 0c12f63

Browse files
committed
Fix tokenizing of regexps after .of
Closes #727
1 parent 832c308 commit 0c12f63

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/tokencontext.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ tt.star.updateContext = function(prevType) {
139139

140140
tt.name.updateContext = function(prevType) {
141141
let allowed = false
142-
if (this.options.ecmaVersion >= 6) {
142+
if (this.options.ecmaVersion >= 6 && prevType != tt.dot) {
143143
if (this.value === "of" && !this.exprAllowed ||
144144
this.value === "yield" && this.inGeneratorContext())
145145
allowed = true

test/tests-harmony.js

+2
Original file line numberDiff line numberDiff line change
@@ -16241,3 +16241,5 @@ test('for ([...foo, bar].baz in qux);', {
1624116241
testFail("var f;\nfunction f() {}", "Identifier 'f' has already been declared (2:9)", {ecmaVersion: 6, sourceType: "module"});
1624216242

1624316243
test("function f() { var x; function x() {} }", {}, {ecmaVersion: 6, sourceType: "module"})
16244+
16245+
test("a.of / 2", {}, {ecmaVersion: 6})

0 commit comments

Comments
 (0)