Use accept for all compiler traversal
This commit is contained in:
@@ -72,6 +72,7 @@ Compiler.prototype = {
|
||||
guid: 0,
|
||||
|
||||
compile: function(program, options) {
|
||||
this.opcodes = [];
|
||||
this.children = [];
|
||||
this.depths = {list: []};
|
||||
this.options = options;
|
||||
@@ -93,7 +94,7 @@ Compiler.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
return this.program(program);
|
||||
return this.accept(program);
|
||||
},
|
||||
|
||||
accept: function(node) {
|
||||
@@ -102,11 +103,9 @@ Compiler.prototype = {
|
||||
|
||||
program: function(program) {
|
||||
var statements = program.statements, statement;
|
||||
this.opcodes = [];
|
||||
|
||||
for(var i=0, l=statements.length; i<l; i++) {
|
||||
statement = statements[i];
|
||||
this[statement.type](statement);
|
||||
this.accept(statements[i]);
|
||||
}
|
||||
this.isSimple = l === 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user