throw parse error on invalid assignments (#1627)
authorAlex Lam S.L <alexlamsl@gmail.com>
Tue, 21 Mar 2017 06:11:32 +0000 (14:11 +0800)
committerGitHub <noreply@github.com>
Tue, 21 Mar 2017 06:11:32 +0000 (14:11 +0800)
fixes #1626

lib/parse.js
test/compress/html_comments.js

index 25fe931..4d37b85 100644 (file)
@@ -1501,9 +1501,7 @@ function parse($TEXT, options) {
     };
 
     function is_assignable(expr) {
-        if (!options.strict) return true;
-        if (expr instanceof AST_This) return false;
-        return (expr instanceof AST_PropAccess || expr instanceof AST_Symbol);
+        return expr instanceof AST_PropAccess || expr instanceof AST_SymbolRef;
     };
 
     var maybe_assign = function(no_in) {
index 8495b43..fe6ff8a 100644 (file)
@@ -47,22 +47,6 @@ html_comment_in_greater_than_or_equal: {
     expect_exact: "function f(a,b){return a-- >=b}";
 }
 
-html_comment_in_right_shift_assign: {
-    input: {
-        // Note: illegal javascript
-        function f(a, b) { return a-- >>= b; }
-    }
-    expect_exact: "function f(a,b){return a-- >>=b}";
-}
-
-html_comment_in_zero_fill_right_shift_assign: {
-    input: {
-        // Note: illegal javascript
-        function f(a, b) { return a-- >>>= b; }
-    }
-    expect_exact: "function f(a,b){return a-- >>>=b}";
-}
-
 html_comment_in_string_literal: {
     input: {
         function f() { return "<!--HTML-->comment in<!--string literal-->"; }