fix in_boolean_context() (two tests were broken)
authorMihai Bazon <mihai@bazon.net>
Fri, 12 Oct 2012 07:49:41 +0000 (10:49 +0300)
committerMihai Bazon <mihai@bazon.net>
Fri, 12 Oct 2012 07:49:41 +0000 (10:49 +0300)
lib/ast.js

index f90223e..689e956 100644 (file)
@@ -904,7 +904,7 @@ TreeWalker.prototype = {
     },
     in_boolean_context: function() {
         var stack = this.stack;
-        var i = stack.length, self = stack[--i];
+        var i = stack.length, self = stack[--i].$self;
         while (i > 0) {
             var p = stack[--i];
             if ((p instanceof AST_If           && p.condition === self) ||
@@ -917,7 +917,7 @@ TreeWalker.prototype = {
             }
             if (!(p instanceof AST_Binary && (p.operator == "&&" || p.operator == "||")))
                 return false;
-            self = p;
+            self = p.$self;
         }
     },
     loopcontrol_target: function(label) {