Skip to content

Commit 7959281

Browse files
fix the javascript version of the python bug too
1 parent de2b0c6 commit 7959281

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

js/src/javascript/tokenizer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ Tokenizer.prototype._allow_regexp_or_xml = function(previous_token) {
371371
// regex and xml can only appear in specific locations during parsing
372372
return (previous_token.type === TOKEN.RESERVED && in_array(previous_token.text, ['return', 'case', 'throw', 'else', 'do', 'typeof', 'yield'])) ||
373373
(previous_token.type === TOKEN.END_EXPR && previous_token.text === ')' &&
374-
previous_token.opened.previous.type === TOKEN.RESERVED && in_array(previous_token.opened.previous.text, ['if', 'while', 'for'])) ||
374+
previous_token.opened && previous_token.opened.previous.type === TOKEN.RESERVED && in_array(previous_token.opened.previous.text, ['if', 'while', 'for'])) ||
375375
(in_array(previous_token.type, [TOKEN.COMMENT, TOKEN.START_EXPR, TOKEN.START_BLOCK, TOKEN.START,
376376
TOKEN.END_BLOCK, TOKEN.OPERATOR, TOKEN.EQUALS, TOKEN.EOF, TOKEN.SEMICOLON, TOKEN.COMMA
377377
]));

0 commit comments

Comments
 (0)