X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/dc15fe8ace017fdef39202474c1563c1ae0ae67a..2c4a8bb6222b88ff96fbf25372179646ce15f706:/libcycript.cy diff --git a/libcycript.cy b/libcycript.cy index 8240a44..7690a29 100644 --- a/libcycript.cy +++ b/libcycript.cy @@ -21,18 +21,26 @@ (function() { +Number.prototype.__defineGetter__('$cyt', function() { + if (this.$cyt_) + return this.$cyt_; + if ((this|0) == this) + return int; +}); + this.typeid = function(object) { return object.$cyt; }; let $cy_set = function(object, properties) { for (const name in properties) + if ("defineProperty" in Object) Object.defineProperty(object, name, { configurable: true, enumerable: false, writable: true, value: properties[name], - }); + }); else object[name] = properties[name]; }; $cy_set(Boolean.prototype, { @@ -72,7 +80,8 @@ $cy_set(Error.prototype, { $cy_set(Number.prototype, { toCYON: function() { if ("$cyt" in this) - return `${this.$cyt.toCYON()}(${this.toString()})`; + //return `${this.$cyt.toCYON()}(${this.toString()})`; + return this.toString(); return `new Number(${this.toString()})`; }, }); @@ -309,7 +318,7 @@ require.resolve = function(name) { if (path != null) return path; } else { - let cwd = new (typedef char[1024]); + let cwd = *new (typedef char[1024]); cwd = getcwd(cwd, cwd.length).toString(); cwd = cwd.split('/');