clean up `TreeWalker.pop()` (#2195)
authorAlex Lam S.L <alexlamsl@gmail.com>
Sun, 2 Jul 2017 19:23:38 +0000 (03:23 +0800)
committerGitHub <noreply@github.com>
Sun, 2 Jul 2017 19:23:38 +0000 (03:23 +0800)
Remove superfluous parameter.

lib/ast.js
lib/transform.js

index 2972b7a..0918574 100644 (file)
@@ -859,7 +859,7 @@ TreeWalker.prototype = {
         if (!ret && descend) {
             descend.call(node);
         }
-        this.pop(node);
+        this.pop();
         return ret;
     },
     parent: function(n) {
@@ -873,9 +873,8 @@ TreeWalker.prototype = {
         }
         this.stack.push(node);
     },
-    pop: function(node) {
-        this.stack.pop();
-        if (node instanceof AST_Lambda) {
+    pop: function() {
+        if (this.stack.pop() instanceof AST_Lambda) {
             this.directives = Object.getPrototypeOf(this.directives);
         }
     },
index 112e5f2..8008e57 100644 (file)
@@ -70,7 +70,7 @@ TreeTransformer.prototype = new TreeWalker;
                     if (y !== undefined) x = y;
                 }
             }
-            tw.pop(this);
+            tw.pop();
             return x;
         });
     };