Wrap AST nodes in strip opcodes if defined

This commit is contained in:
kpdecker
2013-07-30 10:56:58 -05:00
parent 4e4920cc78
commit 151e6d49c0
+14 -2
View File
@@ -98,11 +98,23 @@ Compiler.prototype = {
},
accept: function(node) {
return this[node.type](node);
var strip = node.strip || {},
ret;
if (strip.left) {
this.opcode('strip');
}
ret = this[node.type](node);
if (strip.right) {
this.opcode('strip');
}
return ret;
},
program: function(program) {
var statements = program.statements, statement;
var statements = program.statements;
for(var i=0, l=statements.length; i<l; i++) {
this.accept(statements[i]);