mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-17 19:11:22 -05:00
nicer --tree printing, with values inlines to the right
This commit is contained in:
@@ -108,9 +108,9 @@
|
||||
};
|
||||
// toString representation of the node, for inspecting the parse tree.
|
||||
Node.prototype.toString = function toString(idt) {
|
||||
idt = (idt || '') + TAB;
|
||||
return this.type + '\n' + _.map(this.children, function(child) {
|
||||
return idt + child.toString(idt);
|
||||
idt = idt || '';
|
||||
return '\n' + idt + this.type + _.map(this.children, function(child) {
|
||||
return child.toString(idt + TAB);
|
||||
}).join('');
|
||||
};
|
||||
// Default implementations of the common node methods.
|
||||
@@ -255,7 +255,7 @@
|
||||
return idt + this.value + end;
|
||||
},
|
||||
toString: function toString(idt) {
|
||||
return '"' + this.value + '"' + '\n';
|
||||
return ' "' + this.value + '"';
|
||||
}
|
||||
}));
|
||||
LiteralNode.prototype.is_statement_only = LiteralNode.prototype.is_statement;
|
||||
@@ -806,10 +806,10 @@
|
||||
},
|
||||
toString: function toString(idt) {
|
||||
var children;
|
||||
idt = (idt || '') + TAB;
|
||||
idt = idt || '';
|
||||
children = _.flatten([this.params, this.body.expressions]);
|
||||
return this.type + '\n' + _.map(children, function(child) {
|
||||
return idt + child.toString(idt);
|
||||
return '\n' + idt + this.type + _.map(children, function(child) {
|
||||
return child.toString(idt + TAB);
|
||||
}).join('');
|
||||
}
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user