diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-08-22 15:21:58 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-08-22 15:21:58 +0300 |
commit | 159a6f048cfabc6bdee0bb1274eeb0d6ab75b79a (patch) | |
tree | 16996dd7f421281bb60ad8dbf6666a2424262e48 /lib/ast.js | |
parent | f53e139d3cfc9b2eab0239496181a9485728e066 (diff) | |
download | tracifyjs-159a6f048cfabc6bdee0bb1274eeb0d6ab75b79a.tar.gz tracifyjs-159a6f048cfabc6bdee0bb1274eeb0d6ab75b79a.zip |
wrote more of the compressor and added some tests
Diffstat (limited to 'lib/ast.js')
-rw-r--r-- | lib/ast.js | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -2,6 +2,7 @@ function DEFNODE(type, props, methods, base) { if (arguments.length < 4) base = AST_Node; if (!props) props = []; else props = props.split(/\s+/); + var self_props = props; if (base && base.PROPS) props = props.concat(base.PROPS); var code = "return function AST_" + type + "(props){ if (props) { "; @@ -19,6 +20,7 @@ function DEFNODE(type, props, methods, base) { } ctor.prototype.CTOR = ctor; ctor.PROPS = props || null; + ctor.SELF_PROPS = self_props; if (type) { ctor.prototype.TYPE = ctor.TYPE = type; } @@ -563,7 +565,10 @@ TreeWalker.prototype = { if (!ret && descend) { descend.call(node); } - this.stack.pop(node); + this.stack.pop(); return ret; + }, + parent: function(n) { + return this.stack[this.stack.length - 2 - (n || 0)]; } }; |