Small cleanup

This commit is contained in:
Mihai Bazon
2012-12-12 11:50:03 +02:00
parent 6064bea3db
commit c4993e1e5c

View File

@@ -340,23 +340,25 @@ function OutputStream(options) {
/* -----[ utils ]----- */ /* -----[ utils ]----- */
function DEFPRINT(nodetype, generator) { function DEFPRINT(nodetype, generator) {
nodetype.DEFMETHOD("print", function(stream, force_parens){ nodetype.DEFMETHOD("_codegen", generator);
var self = this; };
stream.push_node(self);
if (force_parens || self.needs_parens(stream)) { AST_Node.DEFMETHOD("print", function(stream, force_parens){
stream.with_parens(function(){ var self = this, generator = self._codegen;
self.add_comments(stream); stream.push_node(self);
self.add_source_map(stream); if (force_parens || self.needs_parens(stream)) {
generator(self, stream); stream.with_parens(function(){
});
} else {
self.add_comments(stream); self.add_comments(stream);
self.add_source_map(stream); self.add_source_map(stream);
generator(self, stream); generator(self, stream);
} });
stream.pop_node(); } else {
}); self.add_comments(stream);
}; self.add_source_map(stream);
generator(self, stream);
}
stream.pop_node();
});
AST_Node.DEFMETHOD("print_to_string", function(options){ AST_Node.DEFMETHOD("print_to_string", function(options){
var s = OutputStream(options); var s = OutputStream(options);
@@ -902,7 +904,7 @@ function OutputStream(options) {
DEFPRINT(AST_New, function(self, output){ DEFPRINT(AST_New, function(self, output){
output.print("new"); output.print("new");
output.space(); output.space();
AST_Call.prototype.print.call(self, output); AST_Call.prototype._codegen(self, output);
}); });
AST_Seq.DEFMETHOD("_do_print", function(output){ AST_Seq.DEFMETHOD("_do_print", function(output){