Small cleanup

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

View File

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