made --nodes output prettier

This commit is contained in:
satyr
2010-09-27 04:47:52 +09:00
parent ecb23d15c4
commit bc87d9ed3d
4 changed files with 21 additions and 28 deletions

View File

@@ -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;
})();