mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 19:34:27 -05:00
made --nodes output prettier
This commit is contained in:
30
lib/nodes.js
30
lib/nodes.js
@@ -275,8 +275,8 @@
|
||||
end = this.isStatement(o) ? ';' : '';
|
||||
return idt + this.value + end;
|
||||
};
|
||||
LiteralNode.prototype.toString = function(idt) {
|
||||
return '"' + this.value + '"';
|
||||
LiteralNode.prototype.toString = function() {
|
||||
return ' "' + this.value + '"';
|
||||
};
|
||||
return LiteralNode;
|
||||
})();
|
||||
@@ -1135,19 +1135,6 @@
|
||||
CodeNode.prototype.traverseChildren = function(crossScope, func) {
|
||||
return crossScope ? CodeNode.__super__.traverseChildren.call(this, crossScope, func) : null;
|
||||
};
|
||||
CodeNode.prototype.toString = function(idt) {
|
||||
var _i, _len, _ref2, _result, child, children;
|
||||
idt || (idt = '');
|
||||
children = (function() {
|
||||
_result = []; _ref2 = this.collectChildren();
|
||||
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
||||
child = _ref2[_i];
|
||||
_result.push(child.toString(idt + TAB));
|
||||
}
|
||||
return _result;
|
||||
}).call(this).join('');
|
||||
return '\n' + idt + children;
|
||||
};
|
||||
return CodeNode;
|
||||
})();
|
||||
exports.ParamNode = (function() {
|
||||
@@ -1165,8 +1152,17 @@
|
||||
ParamNode.prototype.compileNode = function(o) {
|
||||
return this.value.compile(o);
|
||||
};
|
||||
ParamNode.prototype.toString = function(idt) {
|
||||
return this.attach ? (literal('@' + this.name)).toString(idt) : this.value.toString(idt);
|
||||
ParamNode.prototype.toString = function() {
|
||||
var _ref2, name;
|
||||
_ref2 = this;
|
||||
name = _ref2.name;
|
||||
if (this.attach) {
|
||||
name = '@' + name;
|
||||
}
|
||||
if (this.splat) {
|
||||
name += '...';
|
||||
}
|
||||
return literal(name).toString();
|
||||
};
|
||||
return ParamNode;
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user