From: Mihai Bazon Date: Mon, 2 Sep 2013 08:09:54 +0000 (+0300) Subject: Fix parsing `a.case /= 1` X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b0ca896d988bdafe5f28aa13dd14e4d6e4703108;p=UglifyJS.git Fix parsing `a.case /= 1` Close #286 --- diff --git a/lib/parse.js b/lib/parse.js index cc80a935..8801b50b 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -254,10 +254,12 @@ function tokenizer($TEXT, filename) { S.tokpos = S.pos; }; + var prev_was_dot = false; function token(type, value, is_comment) { S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX(value)) || - (type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) || + (!prev_was_dot && type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) || (type == "punc" && PUNC_BEFORE_EXPRESSION(value))); + prev_was_dot = (type == "punc" && value == "."); var ret = { type : type, value : value,