fix unexpected token issue for regex after block case

- Ex: `if (1) {} /foo/`

Fixes babel/babel-eslint#161
Ref marijnh/acorn#289
This commit is contained in:
Henry Zhu
2015-08-10 19:03:13 -04:00
parent 50add6753f
commit 04aedf37b4
3 changed files with 125 additions and 1 deletions

View File

@@ -786,7 +786,7 @@ export default class Tokenizer {
return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
}
if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof) {
if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR) {
return true;
}