Fix is_assignable
authorMihai Bazon <mihai@bazon.net>
Thu, 9 May 2013 05:44:24 +0000 (08:44 +0300)
committerMihai Bazon <mihai@bazon.net>
Thu, 9 May 2013 05:44:24 +0000 (08:44 +0300)
(not likely to be noticed, it's only used in `strict` parse mode)

lib/parse.js

index c45c064..c8c5d0a 100644 (file)
@@ -1340,15 +1340,8 @@ function parse($TEXT, options) {
 
     function is_assignable(expr) {
         if (!options.strict) return true;
-        switch (expr[0]+"") {
-          case "dot":
-          case "sub":
-          case "new":
-          case "call":
-            return true;
-          case "name":
-            return expr[1] != "this";
-        }
+        if (expr instanceof AST_This) return false;
+        return (expr instanceof AST_PropAccess || expr instanceof AST_Symbol);
     };
 
     var maybe_assign = function(no_in) {