Boot.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. var String = require("Modules/String");
  2. var __extends = (this && this.__extends) || function (d, b) {for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];function __() { this.constructor = d; };__.prototype = b.prototype;d.prototype = new __();};
  3. var Boot = (function(_super) {
  4. __extends(Boot, _super);
  5. function Boot (){};
  6. Boot.__string_rec = function(o,s) {
  7. if(o == null) return "null";
  8. if(s.length >= 5) return "<...>";
  9. var t = typeof(o);
  10. if(t == "function" && (o.__name__ || o.__ename__)) t = "object";
  11. switch(t) {
  12. case "object":
  13. if(o instanceof Array) {
  14. if(o.__enum__) {
  15. if(o.length == 2) return o[0];
  16. var str2 = o[0] + "(";
  17. s += "\t";
  18. var _g1 = 2;
  19. var _g = o.length;
  20. while(_g1 < _g) {
  21. var i1 = _g1++;
  22. if(i1 != 2) str2 += "," + Boot.__string_rec(o[i1],s); else str2 += Boot.__string_rec(o[i1],s);
  23. }
  24. return str2 + ")";
  25. }
  26. var l = o.length;
  27. var i;
  28. var str1 = "[";
  29. s += "\t";
  30. var _g2 = 0;
  31. while(_g2 < l) {
  32. var i2 = _g2++;
  33. str1 += (i2 > 0?",":"") + Boot.__string_rec(o[i2],s);
  34. }
  35. str1 += "]";
  36. return str1;
  37. }
  38. var tostr;
  39. try {
  40. tostr = o.toString;
  41. } catch( e ) {
  42. return "???";
  43. }
  44. if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") {
  45. var s2 = o.toString();
  46. if(s2 != "[object Object]") return s2;
  47. }
  48. var k = null;
  49. var str = "{\n";
  50. s += "\t";
  51. var hasp = o.hasOwnProperty != null;
  52. for( var k in o ) {
  53. if(hasp && !o.hasOwnProperty(k)) {
  54. continue;
  55. }
  56. if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") {
  57. continue;
  58. }
  59. if(str.length != 2) str += ", \n";
  60. str += s + k + " : " + Boot.__string_rec(o[k],s);
  61. }
  62. s = s.substring(1);
  63. str += "\n" + s + "}";
  64. return str;
  65. case "function":
  66. return "<function>";
  67. case "string":
  68. return o;
  69. default:
  70. return String(o);
  71. }
  72. };
  73. ;
  74. return Boot;
  75. })(Object);
  76. module.exports = Boot;