fix parsing of property access after new line (#1944)

Account for comments when detecting property access in `tokenizer`.

fixes #1943
This commit is contained in:
Alex Lam S.L
2017-05-16 05:40:49 +08:00
committed by GitHub
parent f18abd1b9c
commit 9464d3c20f
2 changed files with 36 additions and 1 deletions

View File

@@ -285,7 +285,11 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX(value)) ||
(type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) ||
(type == "punc" && PUNC_BEFORE_EXPRESSION(value)));
prev_was_dot = (type == "punc" && value == ".");
if (type == "punc" && value == ".") {
prev_was_dot = true;
} else if (!is_comment) {
prev_was_dot = false;
}
var ret = {
type : type,
value : value,