|
498 | 498 | Obj.prototype = extend(Type.prototype, { |
499 | 499 | constructor: Obj, |
500 | 500 | toString: function(maxDepth) { |
501 | | - if (!maxDepth && this.name) return this.name; |
| 501 | + if (maxDepth == null) maxDepth = 0; |
| 502 | + if (maxDepth <= 0 && this.name) return this.name; |
502 | 503 | var props = [], etc = false; |
503 | 504 | for (var prop in this.props) if (prop != "<i>") { |
504 | 505 | if (props.length > 5) { etc = true; break; } |
|
626 | 627 | Fn.prototype = extend(Obj.prototype, { |
627 | 628 | constructor: Fn, |
628 | 629 | toString: function(maxDepth) { |
629 | | - if (maxDepth) maxDepth--; |
| 630 | + if (maxDepth == null) maxDepth = 0; |
630 | 631 | var str = "fn("; |
631 | 632 | for (var i = 0; i < this.args.length; ++i) { |
632 | 633 | if (i) str += ", "; |
633 | 634 | var name = this.argNames[i]; |
634 | 635 | if (name && name != "?") str += name + ": "; |
635 | | - str += toString(this.args[i], maxDepth, this); |
| 636 | + str += maxDepth > -3 ? toString(this.args[i], maxDepth - 1, this) : "?"; |
636 | 637 | } |
637 | 638 | str += ")"; |
638 | 639 | if (!this.retval.isEmpty()) |
639 | | - str += " -> " + toString(this.retval, maxDepth, this); |
| 640 | + str += " -> " + (maxDepth > -3 ? toString(this.retval, maxDepth - 1, this) : "?"); |
640 | 641 | return str; |
641 | 642 | }, |
642 | 643 | getProp: function(prop) { |
|
674 | 675 | Arr.prototype = extend(Obj.prototype, { |
675 | 676 | constructor: Arr, |
676 | 677 | toString: function(maxDepth) { |
677 | | - return "[" + toString(this.getProp("<i>"), maxDepth, this) + "]"; |
| 678 | + if (maxDepth == null) maxDepth = 0; |
| 679 | + return "[" + (maxDepth > -3 ? toString(this.getProp("<i>"), maxDepth - 1, this) : "?") + "]"; |
678 | 680 | } |
679 | 681 | }); |
680 | 682 |
|
|
0 commit comments