mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
Update JS Interpreter to latest.
This commit is contained in:
@@ -39,36 +39,36 @@ na=/[\n\r\u2028\u2029]/,Y=/\r\n|[\n\r\u2028\u2029]/g,la=a.isIdentifierStart=func
|
||||
"object"==typeof exports&&"object"==typeof module?mod$$inline_58(exports):"function"==typeof define&&define.amd?define(["exports"],mod$$inline_58):mod$$inline_58(this.acorn||(this.acorn={}));
|
||||
// JS-Interpreter: Copyright 2013 Google Inc, Apache 2.0
|
||||
var Interpreter=function(a,b){"string"==typeof a&&(a=acorn.parse(a,Interpreter.PARSE_OPTIONS));this.ast=a;this.initFunc_=b;this.paused_=!1;this.polyfills_=[];this.UNDEFINED=new Interpreter.Primitive(void 0,this);this.NULL=new Interpreter.Primitive(null,this);this.NAN=new Interpreter.Primitive(NaN,this);this.TRUE=new Interpreter.Primitive(!0,this);this.FALSE=new Interpreter.Primitive(!1,this);this.NUMBER_ZERO=new Interpreter.Primitive(0,this);this.NUMBER_ONE=new Interpreter.Primitive(1,this);this.STRING_EMPTY=
|
||||
new Interpreter.Primitive("",this);var c=this.createScope(this.ast,null);this.NAN.parent=this.NUMBER;this.TRUE.parent=this.BOOLEAN;this.FALSE.parent=this.BOOLEAN;this.NUMBER_ZERO.parent=this.NUMBER;this.NUMBER_ONE.parent=this.NUMBER;this.STRING_EMPTY.parent=this.STRING;this.ast=acorn.parse(this.polyfills_.join("\n"),Interpreter.PARSE_OPTIONS);this.polyfills_=void 0;this.stripLocations_(this.ast);this.stateStack=[{node:this.ast,scope:c,thisExpression:c,done:!1}];this.run();this.value=this.UNDEFINED;
|
||||
this.ast=a;this.stateStack=[{node:this.ast,scope:c,thisExpression:c,done:!1}]};Interpreter.PARSE_OPTIONS={ecmaVersion:5};Interpreter.READONLY_DESCRIPTOR={configurable:!0,enumerable:!0,writable:!1};Interpreter.NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!0};Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!1};
|
||||
new Interpreter.Primitive("",this);b=this.createScope(this.ast,null);this.NAN.parent=this.NUMBER;this.TRUE.parent=this.BOOLEAN;this.FALSE.parent=this.BOOLEAN;this.NUMBER_ZERO.parent=this.NUMBER;this.NUMBER_ONE.parent=this.NUMBER;this.STRING_EMPTY.parent=this.STRING;this.ast=acorn.parse(this.polyfills_.join("\n"),Interpreter.PARSE_OPTIONS);this.polyfills_=void 0;this.stripLocations_(this.ast);this.stateStack=[{node:this.ast,scope:b,thisExpression:b,done:!1}];this.run();this.value=this.UNDEFINED;this.ast=
|
||||
a;this.stateStack=[{node:this.ast,scope:b,thisExpression:b,done:!1}]};Interpreter.PARSE_OPTIONS={ecmaVersion:5};Interpreter.READONLY_DESCRIPTOR={configurable:!0,enumerable:!0,writable:!1};Interpreter.NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!0};Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR={configurable:!0,enumerable:!1,writable:!1};
|
||||
Interpreter.prototype.appendCode=function(a){var b=this.stateStack[this.stateStack.length-1];if(!b||"Program"!=b.node.type)throw Error("Expecting original AST to start with a Program node.");"string"==typeof a&&(a=acorn.parse(a,Interpreter.PARSE_OPTIONS));if(!a||"Program"!=a.type)throw Error("Expecting new AST to start with a Program node.");this.populateScope_(a,b.scope);for(var c=0,d;d=a.body[c];c++)b.node.body.push(d);b.done=!1};
|
||||
Interpreter.prototype.step=function(){var a=this.stateStack[0];if(!a||"Program"==a.node.type&&a.done)return!1;if(this.paused_)return!0;this["step"+a.node.type]();return a.node.end?!0:this.step()};Interpreter.prototype.run=function(){for(;!this.paused_&&this.step(););return this.paused_};
|
||||
Interpreter.prototype.initGlobalScope=function(a){this.setProperty(a,"Infinity",this.createPrimitive(Infinity),Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"NaN",this.NAN,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"undefined",this.UNDEFINED,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"window",a,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"self",a);this.initFunction(a);this.initObject(a);a.parent=this.OBJECT;this.initArray(a);this.initNumber(a);this.initString(a);this.initBoolean(a);
|
||||
this.initDate(a);this.initMath(a);this.initRegExp(a);this.initJSON(a);this.initError(a);var b=this,c;c=function(a){a=a||b.UNDEFINED;return b.createPrimitive(isNaN(a.toNumber()))};this.setProperty(a,"isNaN",this.createNativeFunction(c));c=function(a){a=a||b.UNDEFINED;return b.createPrimitive(isFinite(a.toNumber()))};this.setProperty(a,"isFinite",this.createNativeFunction(c));this.setProperty(a,"parseFloat",this.getProperty(this.NUMBER,"parseFloat"));this.setProperty(a,"parseInt",this.getProperty(this.NUMBER,
|
||||
"parseInt"));c=this.createObject(this.FUNCTION);c.eval=!0;this.setProperty(c,"length",this.NUMBER_ONE,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"eval",c);for(var d=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]],g=0;g<d.length;g++)c=function(a){return function(c){c=(c||b.UNDEFINED).toString();try{c=a(c)}catch(u){b.throwException(b.URI_ERROR,u.message)}return b.createPrimitive(c)}}(d[g][0]),
|
||||
this.setProperty(a,d[g][1],this.createNativeFunction(c));this.initFunc_&&this.initFunc_(this,a)};
|
||||
Interpreter.prototype.initFunction=function(a){var b=this,c;c=function(a){for(var c=this.parent==b.FUNCTION?this:b.createObject(b.FUNCTION),d=arguments.length?arguments[arguments.length-1].toString():"",m=[],u=0;u<arguments.length-1;u++)m.push(arguments[u].toString());m=m.join(", ");if(-1!=m.indexOf(")"))throw SyntaxError("Function arg string contains parenthesis");c.parentScope=b.stateStack[b.stateStack.length-1].scope;d=acorn.parse("$ = function("+m+") {"+d+"};",Interpreter.PARSE_OPTIONS);c.node=
|
||||
d.body[0].expression.right;b.setProperty(c,"length",b.createPrimitive(c.node.length),Interpreter.READONLY_DESCRIPTOR);return c};this.FUNCTION=this.createObject(null);this.setProperty(a,"Function",this.FUNCTION);this.FUNCTION.type="function";this.setProperty(this.FUNCTION,"prototype",this.createObject(null));this.FUNCTION.nativeFunc=c;c=function(a,c){var d=b.stateStack[0];d.func_=this;d.funcThis_=a;d.arguments=[];if(c)if(b.isa(c,b.ARRAY))for(var g=0;g<c.length;g++)d.arguments[g]=b.getProperty(c,g);
|
||||
else b.throwException(b.TYPE_ERROR,"CreateListFromArrayLike called on non-object");d.doneArgs_=!0;d.doneExec_=!1};this.setNativeFunctionPrototype(this.FUNCTION,"apply",c);c=function(a,c){var d=b.stateStack[0];d.func_=this;d.funcThis_=a;d.arguments=[];for(var g=1;g<arguments.length;g++)d.arguments.push(arguments[g]);d.doneArgs_=!0;d.doneExec_=!1};this.setNativeFunctionPrototype(this.FUNCTION,"call",c);c=function(a,c){var d=b.createFunction(this.node,this.parentScope);a&&(d.boundThis_=a);d.boundArgs_=
|
||||
[];for(var g=1;g<arguments.length;g++)d.boundArgs_.push(arguments[g]);return d};this.setNativeFunctionPrototype(this.FUNCTION,"bind",c);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.FUNCTION,"toString",c);this.setProperty(this.FUNCTION,"toString",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(){return b.createPrimitive(this.valueOf())};this.setNativeFunctionPrototype(this.FUNCTION,"valueOf",c);this.setProperty(this.FUNCTION,
|
||||
"valueOf",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR)};
|
||||
Interpreter.prototype.initObject=function(a){var b=this,c;c=function(a){if(!a||a==b.UNDEFINED||a==b.NULL)return this.parent==b.OBJECT?this:b.createObject(b.OBJECT);if(a.isPrimitive){var c=b.createObject(a.parent);c.data=a.data;return c}return a};this.OBJECT=this.createNativeFunction(c);this.setProperty(a,"Object",this.OBJECT);c=function(a){var c=b.createObject(b.ARRAY),d=0,m;for(m in a.properties)b.setProperty(c,d,b.createPrimitive(m)),d++;return c};this.setProperty(this.OBJECT,"getOwnPropertyNames",
|
||||
this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){var c=b.createObject(b.ARRAY),d=0,m;for(m in a.properties)a.notEnumerable[m]||(b.setProperty(c,d,b.createPrimitive(m)),d++);return c};this.setProperty(this.OBJECT,"keys",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a,c,h){c=(c||b.UNDEFINED).toString();if(h instanceof Interpreter.Object)if(!a.properties[c]&&a.preventExtensions)b.throwException(b.TYPE_ERROR,"Can't define property "+c+", object is not extensible");
|
||||
else{var d=b.getProperty(h,"value");d==b.UNDEFINED&&(d=null);var g=b.getProperty(h,"get"),q=b.getProperty(h,"set");h={configurable:b.pseudoToNative(b.getProperty(h,"configurable")),enumerable:b.pseudoToNative(b.getProperty(h,"enumerable")),writable:b.pseudoToNative(b.getProperty(h,"writable")),get:g==b.UNDEFINED?void 0:g,set:q==b.UNDEFINED?void 0:q};b.setProperty(a,c,d,h);return a}else b.throwException(b.TYPE_ERROR,"Property description must be an object.")};this.setProperty(this.OBJECT,"defineProperty",
|
||||
this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);this.polyfills_.push("Object.defineProperty(Array.prototype, 'defineProperties', {configurable: true, value:","function(obj, props) {","var keys = Object.keys(props);","for (var i = 0; i < keys.length; i++) {","Object.defineProperty(obj, keys[i], props[keys[i]]);","}","return obj;","}","});","");c=function(a,c){c=(c||b.UNDEFINED).toString();if(!(c in a.properties))return b.UNDEFINED;var d=!a.notConfigurable[c],g=!a.notEnumerable[c],
|
||||
u=!a.notWritable[c],q=a.getter[c],w=a.setter[c],r=b.createObject(b.OBJECT);b.setProperty(r,"configurable",b.createPrimitive(d));b.setProperty(r,"enumerable",b.createPrimitive(g));q||w?(b.setProperty(r,"getter",q),b.setProperty(r,"setter",w)):(b.setProperty(r,"writable",b.createPrimitive(u)),b.setProperty(r,"value",b.getProperty(a,c)));return r};this.setProperty(this.OBJECT,"getOwnPropertyDescriptor",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){return a.parent&&
|
||||
"parseInt"));c=this.createObject(this.FUNCTION);c.eval=!0;this.setProperty(c,"length",this.NUMBER_ONE,Interpreter.READONLY_DESCRIPTOR);this.setProperty(a,"eval",c);for(var d=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]],h=0;h<d.length;h++)c=function(a){return function(c){c=(c||b.UNDEFINED).toString();try{c=a(c)}catch(r){b.throwException(b.URI_ERROR,r.message)}return b.createPrimitive(c)}}(d[h][0]),
|
||||
this.setProperty(a,d[h][1],this.createNativeFunction(c));this.initFunc_&&this.initFunc_(this,a)};
|
||||
Interpreter.prototype.initFunction=function(a){var b=this,c;c=function(a){for(var c=this.parent==b.FUNCTION?this:b.createObject(b.FUNCTION),d=arguments.length?arguments[arguments.length-1].toString():"",p=[],r=0;r<arguments.length-1;r++)p.push(arguments[r].toString());p=p.join(", ");if(-1!=p.indexOf(")"))throw SyntaxError("Function arg string contains parenthesis");c.parentScope=b.stateStack[b.stateStack.length-1].scope;d=acorn.parse("$ = function("+p+") {"+d+"};",Interpreter.PARSE_OPTIONS);c.node=
|
||||
d.body[0].expression.right;b.setProperty(c,"length",b.createPrimitive(c.node.length),Interpreter.READONLY_DESCRIPTOR);return c};this.FUNCTION=this.createObject(null);this.setProperty(a,"Function",this.FUNCTION);this.FUNCTION.type="function";this.setProperty(this.FUNCTION,"prototype",this.createObject(null));this.FUNCTION.nativeFunc=c;c=function(a,c){var d=b.stateStack[0];d.func_=this;d.funcThis_=a;d.arguments=[];if(c)if(b.isa(c,b.ARRAY))for(a=0;a<c.length;a++)d.arguments[a]=b.getProperty(c,a);else b.throwException(b.TYPE_ERROR,
|
||||
"CreateListFromArrayLike called on non-object");d.doneArgs_=!0;d.doneExec_=!1};this.setNativeFunctionPrototype(this.FUNCTION,"apply",c);c=function(a,c){var d=b.stateStack[0];d.func_=this;d.funcThis_=a;d.arguments=[];for(var h=1;h<arguments.length;h++)d.arguments.push(arguments[h]);d.doneArgs_=!0;d.doneExec_=!1};this.setNativeFunctionPrototype(this.FUNCTION,"call",c);c=function(a,c){var d=b.createFunction(this.node,this.parentScope);a&&(d.boundThis_=a);d.boundArgs_=[];for(var h=1;h<arguments.length;h++)d.boundArgs_.push(arguments[h]);
|
||||
return d};this.setNativeFunctionPrototype(this.FUNCTION,"bind",c);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.FUNCTION,"toString",c);this.setProperty(this.FUNCTION,"toString",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(){return b.createPrimitive(this.valueOf())};this.setNativeFunctionPrototype(this.FUNCTION,"valueOf",c);this.setProperty(this.FUNCTION,"valueOf",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR)};
|
||||
Interpreter.prototype.initObject=function(a){var b=this,c;c=function(a){if(!a||a==b.UNDEFINED||a==b.NULL)return this.parent==b.OBJECT?this:b.createObject(b.OBJECT);if(a.isPrimitive){var c=b.createObject(a.parent);c.data=a.data;return c}return a};this.OBJECT=this.createNativeFunction(c);this.setProperty(a,"Object",this.OBJECT);c=function(a){var c=b.createObject(b.ARRAY),d=0,p;for(p in a.properties)b.setProperty(c,d,b.createPrimitive(p)),d++;return c};this.setProperty(this.OBJECT,"getOwnPropertyNames",
|
||||
this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){var c=b.createObject(b.ARRAY),d=0,p;for(p in a.properties)a.notEnumerable[p]||(b.setProperty(c,d,b.createPrimitive(p)),d++);return c};this.setProperty(this.OBJECT,"keys",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a,c,g){c=(c||b.UNDEFINED).toString();if(g instanceof Interpreter.Object)if(!a.properties[c]&&a.preventExtensions)b.throwException(b.TYPE_ERROR,"Can't define property "+c+", object is not extensible");
|
||||
else{var d=b.getProperty(g,"value");d==b.UNDEFINED&&(d=null);var h=b.getProperty(g,"get"),v=b.getProperty(g,"set");g={configurable:b.pseudoToNative(b.getProperty(g,"configurable")),enumerable:b.pseudoToNative(b.getProperty(g,"enumerable")),writable:b.pseudoToNative(b.getProperty(g,"writable")),get:h==b.UNDEFINED?void 0:h,set:v==b.UNDEFINED?void 0:v};b.setProperty(a,c,d,g);return a}else b.throwException(b.TYPE_ERROR,"Property description must be an object.")};this.setProperty(this.OBJECT,"defineProperty",
|
||||
this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);this.polyfills_.push("Object.defineProperty(Array.prototype, 'defineProperties', {configurable: true, value:","function(obj, props) {","var keys = Object.keys(props);","for (var i = 0; i < keys.length; i++) {","Object.defineProperty(obj, keys[i], props[keys[i]]);","}","return obj;","}","});","");c=function(a,c){c=(c||b.UNDEFINED).toString();if(!(c in a.properties))return b.UNDEFINED;var d=!a.notConfigurable[c],h=!a.notEnumerable[c],
|
||||
r=!a.notWritable[c],v=a.getter[c],w=a.setter[c],q=b.createObject(b.OBJECT);b.setProperty(q,"configurable",b.createPrimitive(d));b.setProperty(q,"enumerable",b.createPrimitive(h));v||w?(b.setProperty(q,"getter",v),b.setProperty(q,"setter",w)):(b.setProperty(q,"writable",b.createPrimitive(r)),b.setProperty(q,"value",b.getProperty(a,c)));return q};this.setProperty(this.OBJECT,"getOwnPropertyDescriptor",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){return a.parent&&
|
||||
a.parent.properties&&a.parent.properties.prototype?a.parent.properties.prototype:b.NULL};this.setProperty(this.OBJECT,"getPrototypeOf",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){return b.createPrimitive(!a.preventExtensions)};this.setProperty(this.OBJECT,"isExtensible",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){a.isPrimitive||(a.preventExtensions=!0);return a};this.setProperty(this.OBJECT,"preventExtensions",this.createNativeFunction(c),
|
||||
Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.OBJECT,"toString",c);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.OBJECT,"toLocaleString",c);c=function(){return b.createPrimitive(this.valueOf())};this.setNativeFunctionPrototype(this.OBJECT,"valueOf",c);c=function(a){a=(a||b.UNDEFINED).toString();return a in this.properties?b.TRUE:b.FALSE};this.setNativeFunctionPrototype(this.OBJECT,
|
||||
"hasOwnProperty",c);c=function(a){a=(a||b.UNDEFINED).toString();a=a in this.properties&&!this.notEnumerable[a];return b.createPrimitive(a)};this.setNativeFunctionPrototype(this.OBJECT,"propertyIsEnumerable",c);c=function(a){for(;;)if(a.parent&&a.parent.properties&&a.parent.properties.prototype){if(a=a.parent.properties.prototype,a==this)return b.createPrimitive(!0)}else return b.createPrimitive(!1)};this.setNativeFunctionPrototype(this.OBJECT,"isPrototypeOf",c)};
|
||||
Interpreter.prototype.initArray=function(a){var b=this,c=function(a,b){var c=a?Math.floor(a.toNumber()):b;isNaN(c)&&(c=b);return c},d;d=function(a){var c=this.parent==b.ARRAY?this:b.createObject(b.ARRAY),d=arguments[0];if(d&&"number"==d.type)isNaN(b.arrayIndex(d))&&b.throwException(b.RANGE_ERROR,"Invalid array length"),c.length=d.data;else{for(d=0;d<arguments.length;d++)c.properties[d]=arguments[d];c.length=d}return c};this.ARRAY=this.createNativeFunction(d);this.setProperty(a,"Array",this.ARRAY);
|
||||
d=function(a){return b.createPrimitive(b.isa(a,b.ARRAY))};this.setProperty(this.ARRAY,"isArray",this.createNativeFunction(d),Interpreter.NONENUMERABLE_DESCRIPTOR);d=function(){if(this.length){var a=this.properties[this.length-1];delete this.properties[this.length-1];this.length--}else a=b.UNDEFINED;return a};this.setNativeFunctionPrototype(this.ARRAY,"pop",d);d=function(a){for(var c=0;c<arguments.length;c++)this.properties[this.length]=arguments[c],this.length++;return b.createPrimitive(this.length)};
|
||||
this.setNativeFunctionPrototype(this.ARRAY,"push",d);d=function(){if(this.length){for(var a=this.properties[0],c=1;c<this.length;c++)this.properties[c-1]=this.properties[c];this.length--;delete this.properties[this.length]}else a=b.UNDEFINED;return a};this.setNativeFunctionPrototype(this.ARRAY,"shift",d);d=function(a){for(var c=this.length-1;0<=c;c--)this.properties[c+arguments.length]=this.properties[c];this.length+=arguments.length;for(c=0;c<arguments.length;c++)this.properties[c]=arguments[c];
|
||||
return b.createPrimitive(this.length)};this.setNativeFunctionPrototype(this.ARRAY,"unshift",d);d=function(){for(var a=0;a<this.length/2;a++){var b=this.properties[this.length-a-1];this.properties[this.length-a-1]=this.properties[a];this.properties[a]=b}return this};this.setNativeFunctionPrototype(this.ARRAY,"reverse",d);d=function(a,d,m){a=c(a,0);a=0>a?Math.max(this.length+a,0):Math.min(a,this.length);d=c(d,Infinity);d=Math.min(d,this.length-a);for(var g=b.createObject(b.ARRAY),h=a;h<a+d;h++)g.properties[g.length++]=
|
||||
this.properties[h],this.properties[h]=this.properties[h+d];for(h=a+d;h<this.length-d;h++)this.properties[h]=this.properties[h+d];for(h=this.length-d;h<this.length;h++)delete this.properties[h];this.length-=d;for(h=this.length-1;h>=a;h--)this.properties[h+arguments.length-2]=this.properties[h];this.length+=arguments.length-2;for(h=2;h<arguments.length;h++)this.properties[a+h-2]=arguments[h];return g};this.setNativeFunctionPrototype(this.ARRAY,"splice",d);d=function(a,d){var g=b.createObject(b.ARRAY),
|
||||
h=c(a,0);0>h&&(h=this.length+h);var h=Math.max(0,Math.min(h,this.length)),q=c(d,this.length);0>q&&(q=this.length+q);for(var q=Math.max(0,Math.min(q,this.length)),w=0;h<q;h++){var r=b.getProperty(this,h);b.setProperty(g,w++,r)}return g};this.setNativeFunctionPrototype(this.ARRAY,"slice",d);d=function(a){a=a&&void 0!==a.data?a.toString():void 0;for(var c=[],d=0;d<this.length;d++)c[d]=this.properties[d];return b.createPrimitive(c.join(a))};this.setNativeFunctionPrototype(this.ARRAY,"join",d);d=function(a){for(var c=
|
||||
b.createObject(b.ARRAY),d=0,g=0;g<this.length;g++){var q=b.getProperty(this,g);b.setProperty(c,d++,q)}for(g=0;g<arguments.length;g++){var w=arguments[g];if(b.isa(w,b.ARRAY))for(var r=0;r<w.length;r++)q=b.getProperty(w,r),b.setProperty(c,d++,q);else b.setProperty(c,d++,w)}return c};this.setNativeFunctionPrototype(this.ARRAY,"concat",d);d=function(a,d){a=a||b.UNDEFINED;var g=c(d,0);0>g&&(g=this.length+g);for(g=Math.max(0,g);g<this.length;g++){var h=b.getProperty(this,g);if(h.isPrimitive&&a.isPrimitive?
|
||||
h.data===a.data:h===a)return b.createPrimitive(g)}return b.createPrimitive(-1)};this.setNativeFunctionPrototype(this.ARRAY,"indexOf",d);d=function(a,d){a=a||b.UNDEFINED;var g=c(d,this.length);0>g&&(g=this.length+g);for(g=Math.min(g,this.length-1);0<=g;g--){var h=b.getProperty(this,g);if(h.isPrimitive&&a.isPrimitive?h.data===a.data:h===a)return b.createPrimitive(g)}return b.createPrimitive(-1)};this.setNativeFunctionPrototype(this.ARRAY,"lastIndexOf",d);this.polyfills_.push("Object.defineProperty(Array.prototype, 'every', {configurable: true, value:",
|
||||
"function(callbackfn, thisArg) {","if (this == null || typeof callbackfn !== 'function') throw new TypeError;","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter', {configurable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw new TypeError;",
|
||||
Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.OBJECT,"toString",c);c=function(){return b.createPrimitive(this.toString())};this.setNativeFunctionPrototype(this.OBJECT,"toLocaleString",c);c=function(){return b.createPrimitive(this.valueOf())};this.setNativeFunctionPrototype(this.OBJECT,"valueOf",c);c=function(a){if(this==b.NULL||this==b.UNDEFINED)b.throwException(b.TYPE_ERROR,"Cannot convert undefined or null to object");
|
||||
else return a=(a||b.UNDEFINED).toString(),a in this.properties?b.TRUE:b.FALSE};this.setNativeFunctionPrototype(this.OBJECT,"hasOwnProperty",c);c=function(a){a=(a||b.UNDEFINED).toString();a=a in this.properties&&!this.notEnumerable[a];return b.createPrimitive(a)};this.setNativeFunctionPrototype(this.OBJECT,"propertyIsEnumerable",c);c=function(a){for(;;)if(a.parent&&a.parent.properties&&a.parent.properties.prototype){if(a=a.parent.properties.prototype,a==this)return b.createPrimitive(!0)}else return b.createPrimitive(!1)};
|
||||
this.setNativeFunctionPrototype(this.OBJECT,"isPrototypeOf",c)};
|
||||
Interpreter.prototype.initArray=function(a){var b=this,c=function(a,b){a=a?Math.floor(a.toNumber()):b;isNaN(a)&&(a=b);return a},d;d=function(a){var c=this.parent==b.ARRAY?this:b.createObject(b.ARRAY),d=arguments[0];if(d&&"number"==d.type)isNaN(b.arrayIndex(d))&&b.throwException(b.RANGE_ERROR,"Invalid array length"),c.length=d.data;else{for(d=0;d<arguments.length;d++)c.properties[d]=arguments[d];c.length=d}return c};this.ARRAY=this.createNativeFunction(d);this.setProperty(a,"Array",this.ARRAY);d=function(a){return b.createPrimitive(b.isa(a,
|
||||
b.ARRAY))};this.setProperty(this.ARRAY,"isArray",this.createNativeFunction(d),Interpreter.NONENUMERABLE_DESCRIPTOR);d=function(){if(this.length){var a=this.properties[this.length-1];delete this.properties[this.length-1];this.length--}else a=b.UNDEFINED;return a};this.setNativeFunctionPrototype(this.ARRAY,"pop",d);d=function(a){for(var c=0;c<arguments.length;c++)this.properties[this.length]=arguments[c],this.length++;return b.createPrimitive(this.length)};this.setNativeFunctionPrototype(this.ARRAY,
|
||||
"push",d);d=function(){if(this.length){for(var a=this.properties[0],c=1;c<this.length;c++)this.properties[c-1]=this.properties[c];this.length--;delete this.properties[this.length]}else a=b.UNDEFINED;return a};this.setNativeFunctionPrototype(this.ARRAY,"shift",d);d=function(a){for(var c=this.length-1;0<=c;c--)this.properties[c+arguments.length]=this.properties[c];this.length+=arguments.length;for(c=0;c<arguments.length;c++)this.properties[c]=arguments[c];return b.createPrimitive(this.length)};this.setNativeFunctionPrototype(this.ARRAY,
|
||||
"unshift",d);d=function(){for(var a=0;a<this.length/2;a++){var b=this.properties[this.length-a-1];this.properties[this.length-a-1]=this.properties[a];this.properties[a]=b}return this};this.setNativeFunctionPrototype(this.ARRAY,"reverse",d);d=function(a,d,p){a=c(a,0);a=0>a?Math.max(this.length+a,0):Math.min(a,this.length);d=c(d,Infinity);d=Math.min(d,this.length-a);for(var g=b.createObject(b.ARRAY),h=a;h<a+d;h++)g.properties[g.length++]=this.properties[h],this.properties[h]=this.properties[h+d];for(h=
|
||||
a+d;h<this.length-d;h++)this.properties[h]=this.properties[h+d];for(h=this.length-d;h<this.length;h++)delete this.properties[h];this.length-=d;for(h=this.length-1;h>=a;h--)this.properties[h+arguments.length-2]=this.properties[h];this.length+=arguments.length-2;for(h=2;h<arguments.length;h++)this.properties[a+h-2]=arguments[h];return g};this.setNativeFunctionPrototype(this.ARRAY,"splice",d);d=function(a,d){var g=b.createObject(b.ARRAY),h=c(a,0);0>h&&(h=this.length+h);h=Math.max(0,Math.min(h,this.length));
|
||||
d=c(d,this.length);0>d&&(d=this.length+d);d=Math.max(0,Math.min(d,this.length));for(a=0;h<d;h++){var v=b.getProperty(this,h);b.setProperty(g,a++,v)}return g};this.setNativeFunctionPrototype(this.ARRAY,"slice",d);d=function(a){a=a&&void 0!==a.data?a.toString():void 0;for(var c=[],d=0;d<this.length;d++)c[d]=this.properties[d];return b.createPrimitive(c.join(a))};this.setNativeFunctionPrototype(this.ARRAY,"join",d);d=function(a){for(var c=b.createObject(b.ARRAY),d=0,h=0;h<this.length;h++){var v=b.getProperty(this,
|
||||
h);b.setProperty(c,d++,v)}for(h=0;h<arguments.length;h++){var w=arguments[h];if(b.isa(w,b.ARRAY))for(var q=0;q<w.length;q++)v=b.getProperty(w,q),b.setProperty(c,d++,v);else b.setProperty(c,d++,w)}return c};this.setNativeFunctionPrototype(this.ARRAY,"concat",d);d=function(a,d){a=a||b.UNDEFINED;d=c(d,0);0>d&&(d=this.length+d);for(d=Math.max(0,d);d<this.length;d++){var h=b.getProperty(this,d);if(h.isPrimitive&&a.isPrimitive?h.data===a.data:h===a)return b.createPrimitive(d)}return b.createPrimitive(-1)};
|
||||
this.setNativeFunctionPrototype(this.ARRAY,"indexOf",d);d=function(a,d){a=a||b.UNDEFINED;d=c(d,this.length);0>d&&(d=this.length+d);for(d=Math.min(d,this.length-1);0<=d;d--){var h=b.getProperty(this,d);if(h.isPrimitive&&a.isPrimitive?h.data===a.data:h===a)return b.createPrimitive(d)}return b.createPrimitive(-1)};this.setNativeFunctionPrototype(this.ARRAY,"lastIndexOf",d);this.polyfills_.push("Object.defineProperty(Array.prototype, 'every', {configurable: true, value:","function(callbackfn, thisArg) {",
|
||||
"if (this == null || typeof callbackfn !== 'function') throw new TypeError;","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter', {configurable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw new TypeError;",
|
||||
"var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach', {configurable: true, value:","function(callback, thisArg) {","if (this == null || typeof callback !== 'function') throw new TypeError;","var T, k;","var O = Object(this);",
|
||||
"var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map', {configurable: true, value:","function(callback, thisArg) {","if (this == null || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);",
|
||||
"k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce', {configurable: true, value:","function(callback /*, initialValue*/) {","if (this == null || typeof callback !== 'function') throw new TypeError;","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length == 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw new TypeError('Reduce of empty array with no initial value');","}","value = t[k++];",
|
||||
@@ -84,23 +84,23 @@ Interpreter.prototype.initString=function(a){var b=this,c;c=function(a){a=a?a.to
|
||||
a=["toLowerCase","toUpperCase","toLocaleLowerCase","toLocaleUpperCase"];for(var d=0;d<a.length;d++)c=function(a){return function(){return b.createPrimitive(a.apply(this))}}(String.prototype[a[d]]),this.setNativeFunctionPrototype(this.STRING,a[d],c);c=function(){var a=this.toString();return b.createPrimitive(a.replace(/^\s+|\s+$/g,""))};this.setNativeFunctionPrototype(this.STRING,"trim",c);c=function(){var a=this.toString();return b.createPrimitive(a.replace(/^\s+/g,""))};this.setNativeFunctionPrototype(this.STRING,
|
||||
"trimLeft",c);c=function(){var a=this.toString();return b.createPrimitive(a.replace(/\s+$/g,""))};this.setNativeFunctionPrototype(this.STRING,"trimRight",c);a=["charAt","charCodeAt","substring","slice","substr"];for(d=0;d<a.length;d++)c=function(a){return function(){for(var c=0;c<arguments.length;c++)arguments[c]=arguments[c].toNumber();return b.createPrimitive(a.apply(this,arguments))}}(String.prototype[a[d]]),this.setNativeFunctionPrototype(this.STRING,a[d],c);c=function(a,c){var d=this.toString();
|
||||
a=(a||b.UNDEFINED).toString();c=c?c.toNumber():void 0;return b.createPrimitive(d.indexOf(a,c))};this.setNativeFunctionPrototype(this.STRING,"indexOf",c);c=function(a,c){var d=this.toString();a=(a||b.UNDEFINED).toString();c=c?c.toNumber():void 0;return b.createPrimitive(d.lastIndexOf(a,c))};this.setNativeFunctionPrototype(this.STRING,"lastIndexOf",c);c=function(a,c,d){a=(a||b.UNDEFINED).toString();c=c?b.pseudoToNative(c):void 0;d=d?b.pseudoToNative(d):void 0;return b.createPrimitive(this.toString().localeCompare(a,
|
||||
c,d))};this.setNativeFunctionPrototype(this.STRING,"localeCompare",c);c=function(a,c){var d=this.toString();a=a?b.isa(a,b.REGEXP)?a.data:a.toString():void 0;c=c?c.toNumber():void 0;for(var d=d.split(a,c),g=b.createObject(b.ARRAY),h=0;h<d.length;h++)b.setProperty(g,h,b.createPrimitive(d[h]));return g};this.setNativeFunctionPrototype(this.STRING,"split",c);c=function(a){for(var c=this.toString(),d=0;d<arguments.length;d++)c+=arguments[d].toString();return b.createPrimitive(c)};this.setNativeFunctionPrototype(this.STRING,
|
||||
c,d))};this.setNativeFunctionPrototype(this.STRING,"localeCompare",c);c=function(a,c){var d=this.toString();a=a?b.isa(a,b.REGEXP)?a.data:a.toString():void 0;c=c?c.toNumber():void 0;a=d.split(a,c);c=b.createObject(b.ARRAY);for(d=0;d<a.length;d++)b.setProperty(c,d,b.createPrimitive(a[d]));return c};this.setNativeFunctionPrototype(this.STRING,"split",c);c=function(a){for(var c=this.toString(),d=0;d<arguments.length;d++)c+=arguments[d].toString();return b.createPrimitive(c)};this.setNativeFunctionPrototype(this.STRING,
|
||||
"concat",c);c=function(a){var c=this.toString();a=a?a.data:void 0;a=c.match(a);if(null===a)return b.NULL;for(var c=b.createObject(b.ARRAY),d=0;d<a.length;d++)b.setProperty(c,d,b.createPrimitive(a[d]));return c};this.setNativeFunctionPrototype(this.STRING,"match",c);c=function(a){var c=this.toString();a=a?a.data:void 0;return b.createPrimitive(c.search(a))};this.setNativeFunctionPrototype(this.STRING,"search",c);c=function(a,c){var d=this.toString();a=(a||b.UNDEFINED).valueOf();c=(c||b.UNDEFINED).toString();
|
||||
return b.createPrimitive(d.replace(a,c))};this.setNativeFunctionPrototype(this.STRING,"replace",c)};Interpreter.prototype.initBoolean=function(a){var b=this,c;c=function(a){a=a?a.toBoolean():!1;if(this.parent!=b.BOOLEAN)return b.createPrimitive(a);this.data=a;return this};this.BOOLEAN=this.createNativeFunction(c);this.setProperty(a,"Boolean",this.BOOLEAN)};
|
||||
Interpreter.prototype.initDate=function(a){var b=this,c;c=function(a,c,d,u,q,w,r){if(this.parent==b.DATE)var g=this;else return b.createPrimitive(Date());if(arguments.length)if(1!=arguments.length||"string"!=a.type&&!b.isa(a,b.STRING)){for(var h=[null],m=0;m<arguments.length;m++)h[m+1]=arguments[m]?arguments[m].toNumber():void 0;g.data=new (Function.prototype.bind.apply(Date,h))}else g.data=new Date(a.toString());else g.data=new Date;return g};this.DATE=this.createNativeFunction(c);this.setProperty(a,
|
||||
"Date",this.DATE);c=function(){return b.createPrimitive((new Date).getTime())};this.setProperty(this.DATE,"now",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){a=a?a.toString():void 0;return b.createPrimitive(Date.parse(a))};this.setProperty(this.DATE,"parse",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a,c,d,u,q,w,r){for(var g=[],h=0;h<arguments.length;h++)g[h]=arguments[h]?arguments[h].toNumber():void 0;return b.createPrimitive(Date.UTC.apply(Date,
|
||||
Interpreter.prototype.initDate=function(a){var b=this,c;c=function(a,c,d,r,v,w,q){if(this.parent==b.DATE)var g=this;else return b.createPrimitive(Date());if(arguments.length)if(1!=arguments.length||"string"!=a.type&&!b.isa(a,b.STRING)){for(var h=[null],p=0;p<arguments.length;p++)h[p+1]=arguments[p]?arguments[p].toNumber():void 0;g.data=new (Function.prototype.bind.apply(Date,h))}else g.data=new Date(a.toString());else g.data=new Date;return g};this.DATE=this.createNativeFunction(c);this.setProperty(a,
|
||||
"Date",this.DATE);c=function(){return b.createPrimitive((new Date).getTime())};this.setProperty(this.DATE,"now",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a){a=a?a.toString():void 0;return b.createPrimitive(Date.parse(a))};this.setProperty(this.DATE,"parse",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);c=function(a,c,d,r,v,w,q){for(var g=[],h=0;h<arguments.length;h++)g[h]=arguments[h]?arguments[h].toNumber():void 0;return b.createPrimitive(Date.UTC.apply(Date,
|
||||
g))};this.setProperty(this.DATE,"UTC",this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR);a="getDate getDay getFullYear getHours getMilliseconds getMinutes getMonth getSeconds getTime getTimezoneOffset getUTCDate getUTCDay getUTCFullYear getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds getYear setDate setFullYear setHours setMilliseconds setMinutes setMonth setSeconds setTime setUTCDate setUTCFullYear setUTCHours setUTCMilliseconds setUTCMinutes setUTCMonth setUTCSeconds setYear toDateString toISOString toJSON toGMTString toLocaleDateString toLocaleString toLocaleTimeString toTimeString toUTCString".split(" ");
|
||||
for(var d=0;d<a.length;d++)c=function(a){return function(c){for(var d=[],g=0;g<arguments.length;g++)d[g]=b.pseudoToNative(arguments[g]);return b.createPrimitive(this.data[a].apply(this.data,d))}}(a[d]),this.setNativeFunctionPrototype(this.DATE,a[d],c)};
|
||||
Interpreter.prototype.initMath=function(a){var b=this,c=this.createObject(this.OBJECT);this.setProperty(a,"Math",c);var d="E LN2 LN10 LOG2E LOG10E PI SQRT1_2 SQRT2".split(" ");for(a=0;a<d.length;a++)this.setProperty(c,d[a],this.createPrimitive(Math[d[a]]),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);d="abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin sqrt tan".split(" ");for(a=0;a<d.length;a++){var g=function(a){return function(){for(var c=0;c<arguments.length;c++)arguments[c]=
|
||||
arguments[c].toNumber();return b.createPrimitive(a.apply(Math,arguments))}}(Math[d[a]]);this.setProperty(c,d[a],this.createNativeFunction(g),Interpreter.NONENUMERABLE_DESCRIPTOR)}};
|
||||
Interpreter.prototype.initMath=function(a){var b=this,c=this.createObject(this.OBJECT);this.setProperty(a,"Math",c);var d="E LN2 LN10 LOG2E LOG10E PI SQRT1_2 SQRT2".split(" ");for(a=0;a<d.length;a++)this.setProperty(c,d[a],this.createPrimitive(Math[d[a]]),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);d="abs acos asin atan atan2 ceil cos exp floor log max min pow random round sin sqrt tan".split(" ");for(a=0;a<d.length;a++){var h=function(a){return function(){for(var c=0;c<arguments.length;c++)arguments[c]=
|
||||
arguments[c].toNumber();return b.createPrimitive(a.apply(Math,arguments))}}(Math[d[a]]);this.setProperty(c,d[a],this.createNativeFunction(h),Interpreter.NONENUMERABLE_DESCRIPTOR)}};
|
||||
Interpreter.prototype.initRegExp=function(a){var b=this,c;c=function(a,c){var d=this.parent==b.REGEXP?this:b.createObject(b.REGEXP);a=a?a.toString():"";c=c?c.toString():"";return b.populateRegExp_(d,new RegExp(a,c))};this.REGEXP=this.createNativeFunction(c);this.setProperty(a,"RegExp",this.REGEXP);this.setProperty(this.REGEXP.properties.prototype,"global",this.UNDEFINED,Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);this.setProperty(this.REGEXP.properties.prototype,"ignoreCase",this.UNDEFINED,Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);
|
||||
this.setProperty(this.REGEXP.properties.prototype,"multiline",this.UNDEFINED,Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);this.setProperty(this.REGEXP.properties.prototype,"source",this.createPrimitive("(?:)"),Interpreter.READONLY_NONENUMERABLE_DESCRIPTOR);c=function(a){a=a.toString();return b.createPrimitive(this.data.test(a))};this.setNativeFunctionPrototype(this.REGEXP,"test",c);c=function(a){a=a.toString();this.data.lastIndex=b.getProperty(this,"lastIndex").toNumber();a=this.data.exec(a);b.setProperty(this,
|
||||
"lastIndex",b.createPrimitive(this.data.lastIndex));if(a){for(var c=b.createObject(b.ARRAY),d=0;d<a.length;d++)b.setProperty(c,d,b.createPrimitive(a[d]));b.setProperty(c,"index",b.createPrimitive(a.index));b.setProperty(c,"input",b.createPrimitive(a.input));return c}return b.NULL};this.setNativeFunctionPrototype(this.REGEXP,"exec",c)};
|
||||
Interpreter.prototype.initJSON=function(a){var b=this,c=b.createObject(this.OBJECT);this.setProperty(a,"JSON",c);a=function(a){a=JSON.parse(a.toString());return b.nativeToPseudo(a)};this.setProperty(c,"parse",this.createNativeFunction(a));a=function(a){a=b.pseudoToNative(a);return b.createPrimitive(JSON.stringify(a))};this.setProperty(c,"stringify",this.createNativeFunction(a))};
|
||||
Interpreter.prototype.initJSON=function(a){var b=this,c=b.createObject(this.OBJECT);this.setProperty(a,"JSON",c);a=function(a){try{var c=JSON.parse(a.toString())}catch(g){b.throwException(b.SYNTAX_ERROR,g.message);return}return b.nativeToPseudo(c)};this.setProperty(c,"parse",this.createNativeFunction(a));a=function(a){a=b.pseudoToNative(a);return b.createPrimitive(JSON.stringify(a))};this.setProperty(c,"stringify",this.createNativeFunction(a))};
|
||||
Interpreter.prototype.initError=function(a){var b=this;this.ERROR=this.createNativeFunction(function(a){var c=this.parent==b.ERROR?this:b.createObject(b.ERROR);a&&b.setProperty(c,"message",b.createPrimitive(String(a)),Interpreter.NONENUMERABLE_DESCRIPTOR);return c});this.setProperty(a,"Error",this.ERROR);this.setProperty(this.ERROR.properties.prototype,"message",this.STRING_EMPTY,Interpreter.NONENUMERABLE_DESCRIPTOR);this.setProperty(this.ERROR.properties.prototype,"name",this.createPrimitive("Error"),
|
||||
Interpreter.NONENUMERABLE_DESCRIPTOR);var c=function(c){var d=b.createNativeFunction(function(a){var c=b.isa(this.parent,b.ERROR)?this:b.createObject(d);a&&b.setProperty(c,"message",b.createPrimitive(String(a)),Interpreter.NONENUMERABLE_DESCRIPTOR);return c});b.setProperty(d,"prototype",b.createObject(b.ERROR));b.setProperty(d.properties.prototype,"name",b.createPrimitive(c),Interpreter.NONENUMERABLE_DESCRIPTOR);b.setProperty(a,c,d);return d};c("EvalError");this.RANGE_ERROR=c("RangeError");this.REFERENCE_ERROR=
|
||||
c("ReferenceError");c("SyntaxError");this.TYPE_ERROR=c("TypeError");this.URI_ERROR=c("URIError")};Interpreter.prototype.isa=function(a,b){if(!a||!b)return!1;for(;a.parent!=b;){if(!a.parent||!a.parent.properties.prototype)return!1;a=a.parent.properties.prototype}return!0};
|
||||
Interpreter.prototype.comp=function(a,b){if(a.isPrimitive&&"number"==typeof a&&isNaN(a.data)||b.isPrimitive&&"number"==typeof b&&isNaN(b.data))return NaN;if(a===b)return 0;if(a.isPrimitive&&b.isPrimitive)a=a.data,b=b.data;else return NaN;return a<b?-1:a>b?1:0};Interpreter.prototype.arrayIndex=function(a){a=Number(a);return!isFinite(a)||a!=Math.floor(a)||0>a?NaN:a};
|
||||
c("ReferenceError");this.SYNTAX_ERROR=c("SyntaxError");this.TYPE_ERROR=c("TypeError");this.URI_ERROR=c("URIError")};Interpreter.prototype.isa=function(a,b){if(!a||!b)return!1;for(;a.parent!=b;){if(!a.parent||!a.parent.properties.prototype)return!1;a=a.parent.properties.prototype}return!0};
|
||||
Interpreter.prototype.comp=function(a,b){if(a.isPrimitive&&isNaN(a.data)||b.isPrimitive&&isNaN(b.data))return NaN;if(a===b)return 0;a=a.isPrimitive?a.data:a.toString();b=b.isPrimitive?b.data:b.toString();return a<b?-1:a>b?1:0};Interpreter.prototype.arrayIndex=function(a){a=Number(a);return!isFinite(a)||a!=Math.floor(a)||0>a?NaN:a};
|
||||
Interpreter.Primitive=function(a,b){var c=typeof a;this.data=a;this.type=c;"number"==c?this.parent=b.NUMBER:"string"==c?this.parent=b.STRING:"boolean"==c&&(this.parent=b.BOOLEAN)};Interpreter.Primitive.prototype.data=void 0;Interpreter.Primitive.prototype.type="undefined";Interpreter.Primitive.prototype.parent=null;Interpreter.Primitive.prototype.isPrimitive=!0;Interpreter.Primitive.prototype.toBoolean=function(){return!!this.data};Interpreter.Primitive.prototype.toNumber=function(){return Number(this.data)};
|
||||
Interpreter.Primitive.prototype.toString=function(){return String(this.data)};Interpreter.Primitive.prototype.valueOf=function(){return this.data};Interpreter.prototype.createPrimitive=function(a){return void 0===a?this.UNDEFINED:null===a?this.NULL:!0===a?this.TRUE:!1===a?this.FALSE:0===a?this.NUMBER_ZERO:1===a?this.NUMBER_ONE:""===a?this.STRING_EMPTY:a instanceof RegExp?this.populateRegExp_(this.createObject(this.REGEXP),a):new Interpreter.Primitive(a,this)};
|
||||
Interpreter.Object=function(a){this.notConfigurable=Object.create(null);this.notEnumerable=Object.create(null);this.notWritable=Object.create(null);this.getter=Object.create(null);this.setter=Object.create(null);this.properties=Object.create(null);this.parent=a};Interpreter.Object.prototype.type="object";Interpreter.Object.prototype.parent=null;Interpreter.Object.prototype.isPrimitive=!1;Interpreter.Object.prototype.data=void 0;Interpreter.Object.prototype.toBoolean=function(){return!0};
|
||||
@@ -111,58 +111,59 @@ Interpreter.prototype.populateRegExp_=function(a,b){a.data=b;this.setProperty(a,
|
||||
Interpreter.prototype.createNativeFunction=function(a){var b=this.createObject(this.FUNCTION);b.nativeFunc=a;this.setProperty(b,"length",this.createPrimitive(a.length),Interpreter.READONLY_DESCRIPTOR);return b};Interpreter.prototype.createAsyncFunction=function(a){var b=this.createObject(this.FUNCTION);b.asyncFunc=a;this.setProperty(b,"length",this.createPrimitive(a.length),Interpreter.READONLY_DESCRIPTOR);return b};
|
||||
Interpreter.prototype.nativeToPseudo=function(a){if("boolean"==typeof a||"number"==typeof a||"string"==typeof a||null===a||void 0===a||a instanceof RegExp)return this.createPrimitive(a);var b;if(a instanceof Array){b=this.createObject(this.ARRAY);for(var c=0;c<a.length;c++)this.setProperty(b,c,this.nativeToPseudo(a[c]))}else for(c in b=this.createObject(this.OBJECT),a)this.setProperty(b,c,this.nativeToPseudo(a[c]));return b};
|
||||
Interpreter.prototype.pseudoToNative=function(a){if(a.isPrimitive||this.isa(a,this.NUMBER)||this.isa(a,this.STRING)||this.isa(a,this.BOOLEAN))return a.data;var b;if(this.isa(a,this.ARRAY)){b=[];for(var c=0;c<a.length;c++)b[c]=this.pseudoToNative(a.properties[c])}else for(c in b={},a.properties)b[c]=this.pseudoToNative(a.properties[c]);return b};
|
||||
Interpreter.prototype.getProperty=function(a,b){b=b.toString();a!=this.UNDEFINED&&a!=this.NULL||this.throwException(this.TYPE_ERROR,"Cannot read property '"+b+"' of "+a);if(this.isa(a,this.STRING)){if("length"==b)return this.createPrimitive(a.data.length);var c=this.arrayIndex(b);if(!isNaN(c)&&c<a.data.length)return this.createPrimitive(a.data[c])}else if(this.isa(a,this.ARRAY)&&"length"==b)return this.createPrimitive(a.length);for(;;){if(a.properties&&b in a.properties)return(c=a.getter[b])?(c.isGetter=
|
||||
!0,c):a.properties[b];if(a.parent&&a.parent.properties&&a.parent.properties.prototype)a=a.parent.properties.prototype;else break}return this.UNDEFINED};
|
||||
Interpreter.prototype.getProperty=function(a,b){b=b.toString();if(a==this.UNDEFINED||a==this.NULL)return this.throwException(this.TYPE_ERROR,"Cannot read property '"+b+"' of "+a),null;if(this.isa(a,this.STRING)){if("length"==b)return this.createPrimitive(a.data.length);var c=this.arrayIndex(b);if(!isNaN(c)&&c<a.data.length)return this.createPrimitive(a.data[c])}else if(this.isa(a,this.ARRAY)&&"length"==b)return this.createPrimitive(a.length);for(;;){if(a.properties&&b in a.properties)return(c=a.getter[b])?
|
||||
(c.isGetter=!0,c):a.properties[b];if(a.parent&&a.parent.properties&&a.parent.properties.prototype)a=a.parent.properties.prototype;else break}return this.UNDEFINED};
|
||||
Interpreter.prototype.hasProperty=function(a,b){b=b.toString();if(a.isPrimitive)throw TypeError("Primitive data type has no properties");if("length"==b&&(this.isa(a,this.STRING)||this.isa(a,this.ARRAY)))return!0;if(this.isa(a,this.STRING)){var c=this.arrayIndex(b);if(!isNaN(c)&&c<a.data.length)return!0}for(;;){if(a.properties&&b in a.properties)return!0;if(a.parent&&a.parent.properties&&a.parent.properties.prototype)a=a.parent.properties.prototype;else break}return!1};
|
||||
Interpreter.prototype.setProperty=function(a,b,c,d){b=b.toString();d&&a.notConfigurable[b]&&this.throwException(this.TYPE_ERROR,"Cannot redefine property: "+b);if("object"!=typeof c)throw Error("Failure to wrap a value: "+c);a!=this.UNDEFINED&&a!=this.NULL||this.throwException(this.TYPE_ERROR,"Cannot set property '"+b+"' of "+a);d&&(d.get||d.set)&&(c||void 0!==d.writable)&&this.throwException(this.TYPE_ERROR,"Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");
|
||||
if(!a.isPrimitive){if(this.isa(a,this.STRING)){var g=this.arrayIndex(b);if("length"==b||!isNaN(g)&&g<a.data.length)return}if(this.isa(a,this.ARRAY)){var h;if("length"==b){b=this.arrayIndex(c.toNumber());isNaN(b)&&this.throwException(this.RANGE_ERROR,"Invalid array length");if(b<a.length)for(h in a.properties)h=this.arrayIndex(h),!isNaN(h)&&b<=h&&delete a.properties[h];a.length=b;return}isNaN(h=this.arrayIndex(b))||(a.length=Math.max(a.length,h+1))}if(!a.properties[b]&&a.preventExtensions)a=this.getScope(),
|
||||
a.strict&&this.throwException(this.TYPE_ERROR,"Can't add property "+b+", object is not extensible");else if(d)a.properties[b]=c,d.configurable||(a.notConfigurable[b]=!0),(c=d.get)?a.getter[b]=c:delete a.getter[b],(h=d.set)?a.setter[b]=h:delete a.setter[b],(g=d.enumerable||!1)?delete a.notEnumerable[b]:a.notEnumerable[b]=!0,c||h?(delete a.notWritable[b],a.properties[b]=this.UNDEFINED):(d=d.writable||!1)?delete a.notWritable[b]:a.notWritable[b]=!0;else{for(d=a;;){if(d.setter&&d.setter[b])return d.setter[b];
|
||||
if(!a.isPrimitive){if(this.isa(a,this.STRING)){var h=this.arrayIndex(b);if("length"==b||!isNaN(h)&&h<a.data.length)return}if(this.isa(a,this.ARRAY)){var g;if("length"==b){b=this.arrayIndex(c.toNumber());isNaN(b)&&this.throwException(this.RANGE_ERROR,"Invalid array length");if(b<a.length)for(g in a.properties)g=this.arrayIndex(g),!isNaN(g)&&b<=g&&delete a.properties[g];a.length=b;return}isNaN(g=this.arrayIndex(b))||(a.length=Math.max(a.length,g+1))}if(!a.properties[b]&&a.preventExtensions)a=this.getScope(),
|
||||
a.strict&&this.throwException(this.TYPE_ERROR,"Can't add property "+b+", object is not extensible");else if(d)a.properties[b]=c,d.configurable||(a.notConfigurable[b]=!0),(c=d.get)?a.getter[b]=c:delete a.getter[b],(g=d.set)?a.setter[b]=g:delete a.setter[b],(h=d.enumerable||!1)?delete a.notEnumerable[b]:a.notEnumerable[b]=!0,c||g?(delete a.notWritable[b],a.properties[b]=this.UNDEFINED):(d=d.writable||!1)?delete a.notWritable[b]:a.notWritable[b]=!0;else{for(d=a;;){if(d.setter&&d.setter[b])return d.setter[b];
|
||||
if(d.parent&&d.parent.properties&&d.parent.properties.prototype)d=d.parent.properties.prototype;else break}a.notWritable[b]||(a.properties[b]=c)}}};Interpreter.prototype.setNativeFunctionPrototype=function(a,b,c){this.setProperty(a.properties.prototype,b,this.createNativeFunction(c),Interpreter.NONENUMERABLE_DESCRIPTOR)};Interpreter.prototype.deleteProperty=function(a,b){b=b.toString();return a.isPrimitive||a.notWritable[b]||"length"==b&&this.isa(a,this.ARRAY)?!1:delete a.properties[b]};
|
||||
Interpreter.prototype.getScope=function(){for(var a=0;a<this.stateStack.length;a++)if(this.stateStack[a].scope)return this.stateStack[a].scope;throw Error("No scope found.");};Interpreter.prototype.createScope=function(a,b){var c=this.createObject(null);(c.parentScope=b)||this.initGlobalScope(c);this.populateScope_(a,c);c.strict=!1;if(b&&b.strict)c.strict=!0;else{var d=a.body&&a.body[0];d&&d.expression&&"Literal"==d.expression.type&&"use strict"==d.expression.value&&(c.strict=!0)}return c};
|
||||
Interpreter.prototype.createSpecialScope=function(a,b){if(!a)throw Error("parentScope required");var c=b||this.createObject(null);c.parentScope=a;c.strict=a.strict;return c};Interpreter.prototype.getValueFromScope=function(a){var b=this.getScope();for(a=a.toString();b;){if(a in b.properties)return b.properties[a];b=b.parentScope}this.throwException(this.REFERENCE_ERROR,a+" is not defined");return this.UNDEFINED};
|
||||
Interpreter.prototype.setValueToScope=function(a,b){for(var c=this.getScope(),d=c.strict,g=a.toString();c;){if(g in c.properties||!d&&!c.parentScope){c.notWritable[g]||(c.properties[g]=b);return}c=c.parentScope}this.throwException(this.REFERENCE_ERROR,g+" is not defined")};
|
||||
Interpreter.prototype.populateScope_=function(a,b){if("VariableDeclaration"==a.type)for(var c=0;c<a.declarations.length;c++)this.setProperty(b,a.declarations[c].id.name,this.UNDEFINED);else{if("FunctionDeclaration"==a.type){this.setProperty(b,a.id.name,this.createFunction(a,b));return}if("FunctionExpression"==a.type)return}var d=a.constructor,g;for(g in a){var h=a[g];if(h&&"object"==typeof h)if(h instanceof Array)for(c=0;c<h.length;c++)h[c]&&h[c].constructor==d&&this.populateScope_(h[c],b);else h.constructor==
|
||||
d&&this.populateScope_(h,b)}};Interpreter.prototype.stripLocations_=function(a){delete a.start;delete a.end;for(var b in a)if(a.hasOwnProperty(b)){var c=a[b];c&&"object"==typeof c&&this.stripLocations_(c)}};Interpreter.prototype.getValue=function(a){if(a instanceof Array){var b=a[0];a=a[1];return this.getProperty(b,a)}return this.getValueFromScope(a)};Interpreter.prototype.setValue=function(a,b){if(a instanceof Array){var c=a[0],d=a[1];return this.setProperty(c,d,b)}this.setValueToScope(a,b)};
|
||||
Interpreter.prototype.throwException=function(a,b){if(this.stateStack[0].interpreter)try{this.stateStack[0].interpreter.throwException(a,b);return}catch(g){}if(void 0===b)var c=a;else c=this.createObject(a),this.setProperty(c,"message",this.createPrimitive(b),Interpreter.NONENUMERABLE_DESCRIPTOR);do var d=this.stateStack.shift();while(d&&"TryStatement"!==d.node.type);if(d)this.stateStack.unshift({node:d.node.handler,throwValue:c});else throw this.isa(c,this.ERROR)?(d={EvalError:EvalError,RangeError:RangeError,
|
||||
ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError},d=d[this.getProperty(c,"name")]||Error,c=d(this.getProperty(c,"message"))):c=c.toString(),c;};
|
||||
Interpreter.prototype.getScope=function(){for(var a=0;a<this.stateStack.length;a++)if(this.stateStack[a].scope)return this.stateStack[a].scope;throw Error("No scope found.");};Interpreter.prototype.createScope=function(a,b){var c=this.createObject(null);(c.parentScope=b)||this.initGlobalScope(c);this.populateScope_(a,c);c.strict=!1;b&&b.strict?c.strict=!0:(a=a.body&&a.body[0])&&a.expression&&"Literal"==a.expression.type&&"use strict"==a.expression.value&&(c.strict=!0);return c};
|
||||
Interpreter.prototype.createSpecialScope=function(a,b){if(!a)throw Error("parentScope required");b=b||this.createObject(null);b.parentScope=a;b.strict=a.strict;return b};Interpreter.prototype.getValueFromScope=function(a){var b=this.getScope();for(a=a.toString();b;){if(a in b.properties)return b.properties[a];b=b.parentScope}this.throwException(this.REFERENCE_ERROR,a+" is not defined");return null};
|
||||
Interpreter.prototype.setValueToScope=function(a,b){var c=this.getScope(),d=c.strict;for(a=a.toString();c;){if(a in c.properties||!d&&!c.parentScope){c.notWritable[a]||(c.properties[a]=b);return}c=c.parentScope}this.throwException(this.REFERENCE_ERROR,a+" is not defined")};
|
||||
Interpreter.prototype.populateScope_=function(a,b){if("VariableDeclaration"==a.type)for(var c=0;c<a.declarations.length;c++)this.setProperty(b,a.declarations[c].id.name,this.UNDEFINED);else{if("FunctionDeclaration"==a.type){this.setProperty(b,a.id.name,this.createFunction(a,b));return}if("FunctionExpression"==a.type)return}var d=a.constructor,h;for(h in a){var g=a[h];if(g&&"object"==typeof g)if(g instanceof Array)for(c=0;c<g.length;c++)g[c]&&g[c].constructor==d&&this.populateScope_(g[c],b);else g.constructor==
|
||||
d&&this.populateScope_(g,b)}};Interpreter.prototype.stripLocations_=function(a){delete a.start;delete a.end;for(var b in a)if(a.hasOwnProperty(b)){var c=a[b];c&&"object"==typeof c&&this.stripLocations_(c)}};Interpreter.prototype.getValue=function(a){if(a instanceof Array){var b=a[0];a=a[1];return this.getProperty(b,a)}return this.getValueFromScope(a)};Interpreter.prototype.setValue=function(a,b){if(a instanceof Array){var c=a[0];a=a[1];return this.setProperty(c,a,b)}this.setValueToScope(a,b)};
|
||||
Interpreter.prototype.throwException=function(a,b){if(this.stateStack[0].interpreter)try{this.stateStack[0].interpreter.throwException(a,b);return}catch(c){}void 0!==b&&(a=this.createObject(a),this.setProperty(a,"message",this.createPrimitive(b),Interpreter.NONENUMERABLE_DESCRIPTOR));this.executeException(a)};
|
||||
Interpreter.prototype.executeException=function(a){do{this.stateStack.shift();var b=this.stateStack[0];if("TryStatement"==b.node.type){b.throwValue=a;return}}while(b&&"Program"!=b.node.type);if(this.isa(a,this.ERROR)){var b={EvalError:EvalError,RangeError:RangeError,ReferenceError:ReferenceError,SyntaxError:SyntaxError,TypeError:TypeError,URIError:URIError},c=this.getProperty(a,"name").toString();a=this.getProperty(a,"message").valueOf();b=b[c]||Error;a=b(a)}else a=a.toString();throw a;};
|
||||
Interpreter.prototype.stepArrayExpression=function(){var a=this.stateStack[0],b=a.node,c=a.n||0;a.array?a.value&&this.setProperty(a.array,c-1,a.value):a.array=this.createObject(this.ARRAY);c<b.elements.length?(a.n=c+1,b.elements[c]?this.stateStack.unshift({node:b.elements[c]}):a.value=void 0):(a.array.length=a.n||0,this.stateStack.shift(),this.stateStack[0].value=a.array)};
|
||||
Interpreter.prototype.stepAssignmentExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneLeft)if(a.doneRight)if(a.doneSetter_)this.stateStack.shift(),this.stateStack[0].value=a.doneSetter_;else{var c=a.value;if("="==b.operator)b=c;else{var d=a.leftValue.toNumber(),g=c.toNumber();if("+="==b.operator)"string"==a.leftValue.type||"string"==c.type?(b=a.leftValue.toString(),c=c.toString()):(b=d,c=g),b+=c;else if("-="==b.operator)b=d-g;else if("*="==b.operator)b=d*g;else if("/="==b.operator)b=
|
||||
d/g;else if("%="==b.operator)b=d%g;else if("<<="==b.operator)b=d<<g;else if(">>="==b.operator)b=d>>g;else if(">>>="==b.operator)b=d>>>g;else if("&="==b.operator)b=d&g;else if("^="==b.operator)b=d^g;else if("|="==b.operator)b=d|g;else throw SyntaxError("Unknown assignment expression: "+b.operator);b=this.createPrimitive(b)}(c=this.setValue(a.leftSide,b))?(a.doneSetter_=b,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:c,doneArgs_:!0,arguments:[b]})):
|
||||
Interpreter.prototype.stepAssignmentExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneLeft)if(a.doneRight)if(a.doneSetter_)this.stateStack.shift(),this.stateStack[0].value=a.doneSetter_;else{var c=a.value;if("="==b.operator)b=c;else{var d=a.leftValue.toNumber(),h=c.toNumber();if("+="==b.operator)"string"==a.leftValue.type||"string"==c.type?(b=a.leftValue.toString(),c=c.toString()):(b=d,c=h),b+=c;else if("-="==b.operator)b=d-h;else if("*="==b.operator)b=d*h;else if("/="==b.operator)b=
|
||||
d/h;else if("%="==b.operator)b=d%h;else if("<<="==b.operator)b=d<<h;else if(">>="==b.operator)b=d>>h;else if(">>>="==b.operator)b=d>>>h;else if("&="==b.operator)b=d&h;else if("^="==b.operator)b=d^h;else if("|="==b.operator)b=d|h;else throw SyntaxError("Unknown assignment expression: "+b.operator);b=this.createPrimitive(b)}(c=this.setValue(a.leftSide,b))?(a.doneSetter_=b,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:c,doneArgs_:!0,arguments:[b]})):
|
||||
(this.stateStack.shift(),this.stateStack[0].value=b)}else{a.leftSide||(a.leftSide=a.value);a.doneGetter_&&(a.leftValue=a.value);if(!a.doneGetter_&&"="!=b.operator&&(a.leftValue=this.getValue(a.leftSide),a.leftValue.isGetter)){a.leftValue.isGetter=!1;a.doneGetter_=!0;this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:a.leftValue,doneArgs_:!0,arguments:[]});return}a.doneRight=!0;this.stateStack.unshift({node:b.right})}else a.doneLeft=!0,this.stateStack.unshift({node:b.left,
|
||||
components:!0})};
|
||||
Interpreter.prototype.stepBinaryExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneLeft)if(a.doneRight){this.stateStack.shift();var c=a.leftValue,a=a.value,d=this.comp(c,a);if("=="==b.operator||"!="==b.operator)c=c.isPrimitive&&a.isPrimitive?c.data==a.data:0===d,"!="==b.operator&&(c=!c);else if("==="==b.operator||"!=="==b.operator)c=c.isPrimitive&&a.isPrimitive?c.data===a.data:c===a,"!=="==b.operator&&(c=!c);else if(">"==b.operator)c=1==d;else if(">="==b.operator)c=1==d||0===d;else if("<"==
|
||||
b.operator)c=-1==d;else if("<="==b.operator)c=-1==d||0===d;else if("+"==b.operator)"string"==c.type||"string"==a.type?(c=c.toString(),a=a.toString()):(c=c.toNumber(),a=a.toNumber()),c+=a;else if("in"==b.operator)c=this.hasProperty(a,c);else if("instanceof"==b.operator)this.isa(a,this.FUNCTION)||this.throwException(this.TYPE_ERROR,"Expecting a function in instanceof check"),c=this.isa(c,a);else if(c=c.toNumber(),a=a.toNumber(),"-"==b.operator)c-=a;else if("*"==b.operator)c*=a;else if("/"==b.operator)c/=
|
||||
a;else if("%"==b.operator)c%=a;else if("&"==b.operator)c&=a;else if("|"==b.operator)c|=a;else if("^"==b.operator)c^=a;else if("<<"==b.operator)c<<=a;else if(">>"==b.operator)c>>=a;else if(">>>"==b.operator)c>>>=a;else throw SyntaxError("Unknown binary operator: "+b.operator);this.stateStack[0].value=this.createPrimitive(c)}else a.doneRight=!0,a.leftValue=a.value,this.stateStack.unshift({node:b.right});else a.doneLeft=!0,this.stateStack.unshift({node:b.left})};
|
||||
b.operator)c=-1==d;else if("<="==b.operator)c=-1==d||0===d;else if("+"==b.operator)c=c.isPrimitive?c.data:c.toString(),a=a.isPrimitive?a.data:a.toString(),c+=a;else if("in"==b.operator)c=this.hasProperty(a,c);else if("instanceof"==b.operator)this.isa(a,this.FUNCTION)||this.throwException(this.TYPE_ERROR,"Expecting a function in instanceof check"),c=this.isa(c,a);else if(c=c.toNumber(),a=a.toNumber(),"-"==b.operator)c-=a;else if("*"==b.operator)c*=a;else if("/"==b.operator)c/=a;else if("%"==b.operator)c%=
|
||||
a;else if("&"==b.operator)c&=a;else if("|"==b.operator)c|=a;else if("^"==b.operator)c^=a;else if("<<"==b.operator)c<<=a;else if(">>"==b.operator)c>>=a;else if(">>>"==b.operator)c>>>=a;else throw SyntaxError("Unknown binary operator: "+b.operator);this.stateStack[0].value=this.createPrimitive(c)}else a.doneRight=!0,a.leftValue=a.value,this.stateStack.unshift({node:b.right});else a.doneLeft=!0,this.stateStack.unshift({node:b.left})};
|
||||
Interpreter.prototype.stepBlockStatement=function(){var a=this.stateStack[0],b=a.node,c=a.n_||0;b.body[c]?(a.done=!1,a.n_=c+1,this.stateStack.unshift({node:b.body[c]})):(a.done=!0,"Program"!=a.node.type&&this.stateStack.shift())};
|
||||
Interpreter.prototype.stepBreakStatement=function(){var a=this.stateStack.shift(),a=a.node,b=null;a.label&&(b=a.label.name);for(a=this.stateStack.shift();a&&"CallExpression"!=a.node.type&&"NewExpression"!=a.node.type;){if(b?b==a.label:a.isLoop||a.isSwitch)return;a=this.stateStack.shift()}throw SyntaxError("Illegal break statement");};
|
||||
Interpreter.prototype.stepCallExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneCallee_){if(!a.func_){if("function"==a.value.type)a.func_=a.value;else if(a.value.length&&(a.member_=a.value[0]),a.func_=this.getValue(a.value),!a.func_||"function"!=a.func_.type){this.throwException(this.TYPE_ERROR,(a.value&&a.value.type)+" is not a function");return}"NewExpression"==a.node.type?(a.funcThis_=this.createObject(a.func_),a.isConstructor_=!0):a.funcThis_=a.func_.boundThis_?a.func_.boundThis_:
|
||||
Interpreter.prototype.stepCallExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneCallee_){if(!a.func_){if("function"==a.value.type)a.func_=a.value;else{a.value.length&&(a.member_=a.value[0]);a.func_=this.getValue(a.value);if(!a.func_)return;if("function"!=a.func_.type){this.throwException(this.TYPE_ERROR,(a.value&&a.value.type)+" is not a function");return}}"NewExpression"==a.node.type?(a.funcThis_=this.createObject(a.func_),a.isConstructor_=!0):a.funcThis_=a.func_.boundThis_?a.func_.boundThis_:
|
||||
a.value.length?a.value[0]:this.stateStack[this.stateStack.length-1].thisExpression;a.arguments=a.func_.boundArgs_?a.func_.boundArgs_.concat():[];a.n_=0}if(!a.doneArgs_){0!=a.n_&&a.arguments.push(a.value);if(b.arguments[a.n_]){this.stateStack.unshift({node:b.arguments[a.n_]});a.n_++;return}a.doneArgs_=!0}if(a.doneExec_)this.stateStack.shift(),this.stateStack[0].value=a.isConstructor_&&"object"!==a.value.type?a.funcThis_:a.value;else if(a.doneExec_=!0,a.func_.node){for(var b=this.createScope(a.func_.node.body,
|
||||
a.func_.parentScope),c=0;c<a.func_.node.params.length;c++){var d=this.createPrimitive(a.func_.node.params[c].name),g=a.arguments.length>c?a.arguments[c]:this.UNDEFINED;this.setProperty(b,d,g)}d=this.createObject(this.ARRAY);for(c=0;c<a.arguments.length;c++)this.setProperty(d,this.createPrimitive(c),a.arguments[c]);this.setProperty(b,"arguments",d);b={node:a.func_.node.body,scope:b,thisExpression:a.funcThis_};this.stateStack.unshift(b);a.value=this.UNDEFINED}else if(a.func_.nativeFunc)a.value=a.func_.nativeFunc.apply(a.funcThis_,
|
||||
a.arguments);else if(a.func_.asyncFunc){var h=this,b=function(b){a.value=b||h.UNDEFINED;h.paused_=!1},b=a.arguments.concat(b);a.func_.asyncFunc.apply(a.funcThis_,b);this.paused_=!0}else if(a.func_.eval)(b=a.arguments[0])?b.isPrimitive?(b=new Interpreter(b.toString()),b.stateStack[0].scope=this.getScope(),a={node:{type:"Eval_"},interpreter:b},this.stateStack.unshift(a)):a.value=b:a.value=this.UNDEFINED;else throw TypeError("function not a function (huh?)");}else a.doneCallee_=!0,this.stateStack.unshift({node:b.callee,
|
||||
a.func_.parentScope),c=0;c<a.func_.node.params.length;c++){var d=this.createPrimitive(a.func_.node.params[c].name),h=a.arguments.length>c?a.arguments[c]:this.UNDEFINED;this.setProperty(b,d,h)}d=this.createObject(this.ARRAY);for(c=0;c<a.arguments.length;c++)this.setProperty(d,this.createPrimitive(c),a.arguments[c]);this.setProperty(b,"arguments",d);b={node:a.func_.node.body,scope:b,thisExpression:a.funcThis_};this.stateStack.unshift(b);a.value=this.UNDEFINED}else if(a.func_.nativeFunc)a.value=a.func_.nativeFunc.apply(a.funcThis_,
|
||||
a.arguments);else if(a.func_.asyncFunc){var g=this,b=function(b){a.value=b||g.UNDEFINED;g.paused_=!1},b=a.arguments.concat(b);a.func_.asyncFunc.apply(a.funcThis_,b);this.paused_=!0}else if(a.func_.eval)(b=a.arguments[0])?b.isPrimitive?(b=new Interpreter(b.toString()),b.stateStack[0].scope=this.getScope(),a={node:{type:"Eval_"},interpreter:b},this.stateStack.unshift(a)):a.value=b:a.value=this.UNDEFINED;else throw TypeError("function not a function (huh?)");}else a.doneCallee_=!0,this.stateStack.unshift({node:b.callee,
|
||||
components:!0})};Interpreter.prototype.stepCatchClause=function(){var a=this.stateStack[0],b=a.node;if(a.doneBody)this.stateStack.shift();else{a.doneBody=!0;var c;if(b.param){c=this.createSpecialScope(this.getScope());var d=this.createPrimitive(b.param.name);this.setProperty(c,d,a.throwValue)}this.stateStack.unshift({node:b.body,scope:c})}};
|
||||
Interpreter.prototype.stepConditionalExpression=function(){var a=this.stateStack[0];a.done?(this.stateStack.shift(),"ConditionalExpression"==a.node.type&&(this.stateStack[0].value=a.value)):a.test?(a.done=!0,a.value.toBoolean()&&a.node.consequent?this.stateStack.unshift({node:a.node.consequent}):!a.value.toBoolean()&&a.node.alternate&&this.stateStack.unshift({node:a.node.alternate})):(a.test=!0,this.stateStack.unshift({node:a.node.test}))};
|
||||
Interpreter.prototype.stepContinueStatement=function(){var a=this.stateStack[0].node,b=null;a.label&&(b=a.label.name);for(a=this.stateStack[0];a&&"CallExpression"!=a.node.type&&"NewExpression"!=a.node.type;){if(a.isLoop&&(!b||b==a.label))return;this.stateStack.shift();a=this.stateStack[0]}throw SyntaxError("Illegal continue statement");};
|
||||
Interpreter.prototype.stepDoWhileStatement=function(){var a=this.stateStack[0];a.isLoop=!0;"DoWhileStatement"==a.node.type&&void 0===a.test&&(a.value=this.TRUE,a.test=!0);a.test?(a.test=!1,a.value.toBoolean()?a.node.body&&this.stateStack.unshift({node:a.node.body}):this.stateStack.shift()):(a.test=!0,this.stateStack.unshift({node:a.node.test}))};Interpreter.prototype.stepEmptyStatement=function(){this.stateStack.shift()};
|
||||
Interpreter.prototype.stepEval_=function(){var a=this.stateStack[0];a.interpreter.step()||(this.stateStack.shift(),this.stateStack[0].value=a.interpreter.value||this.UNDEFINED)};Interpreter.prototype.stepExpressionStatement=function(){var a=this.stateStack[0];a.done?(this.stateStack.shift(),this.value=a.value):(a.done=!0,this.stateStack.unshift({node:a.node.expression}))};
|
||||
Interpreter.prototype.stepForInStatement=function(){var a=this.stateStack[0];a.isLoop=!0;var b=a.node;if(a.doneVariable_)if(a.doneObject_){"undefined"==typeof a.iterator&&(a.object=a.value,a.iterator=0);var c=null;a:do{var d=a.iterator,g;for(g in a.object.properties)if(!a.object.notEnumerable[g]){if(0==d){c=g;break a}d--}a.object=a.object.parent&&a.object.parent.properties.prototype;a.iterator=0}while(a.object);a.iterator++;null===c?this.stateStack.shift():(this.setValueToScope(a.variable,this.createPrimitive(c)),
|
||||
Interpreter.prototype.stepForInStatement=function(){var a=this.stateStack[0];a.isLoop=!0;var b=a.node;if(a.doneVariable_)if(a.doneObject_){"undefined"==typeof a.iterator&&(a.object=a.value,a.iterator=0);var c=null;a:do{var d=a.iterator,h;for(h in a.object.properties)if(!a.object.notEnumerable[h]){if(0==d){c=h;break a}d--}a.object=a.object.parent&&a.object.parent.properties.prototype;a.iterator=0}while(a.object);a.iterator++;null===c?this.stateStack.shift():(this.setValueToScope(a.variable,this.createPrimitive(c)),
|
||||
b.body&&this.stateStack.unshift({node:b.body}))}else a.doneObject_=!0,a.variable=a.value,this.stateStack.unshift({node:b.right});else a.doneVariable_=!0,a=b.left,"VariableDeclaration"==a.type&&(a=a.declarations[0].id),this.stateStack.unshift({node:a,components:!0})};
|
||||
Interpreter.prototype.stepForStatement=function(){var a=this.stateStack[0];a.isLoop=!0;var b=a.node,c=a.mode||0;0==c?(a.mode=1,b.init&&this.stateStack.unshift({node:b.init})):1==c?(a.mode=2,b.test&&this.stateStack.unshift({node:b.test})):2==c?(a.mode=3,b.test&&a.value&&!a.value.toBoolean()?this.stateStack.shift():b.body&&this.stateStack.unshift({node:b.body})):3==c&&(a.mode=1,b.update&&this.stateStack.unshift({node:b.update}))};Interpreter.prototype.stepFunctionDeclaration=function(){this.stateStack.shift()};
|
||||
Interpreter.prototype.stepFunctionExpression=function(){var a=this.stateStack.shift();this.stateStack[0].value=this.createFunction(a.node)};Interpreter.prototype.stepIdentifier=function(){var a=this.stateStack.shift(),b=this.createPrimitive(a.node.name);this.stateStack[0].value=a.components?b:this.getValueFromScope(b)};Interpreter.prototype.stepIfStatement=Interpreter.prototype.stepConditionalExpression;
|
||||
Interpreter.prototype.stepLabeledStatement=function(){var a=this.stateStack.shift();this.stateStack.unshift({node:a.node.body,label:a.node.label.name})};Interpreter.prototype.stepLiteral=function(){var a=this.stateStack.shift();this.stateStack[0].value=this.createPrimitive(a.node.value)};
|
||||
Interpreter.prototype.stepLogicalExpression=function(){var a=this.stateStack[0],b=a.node;if("&&"!=b.operator&&"||"!=b.operator)throw SyntaxError("Unknown logical operator: "+b.operator);a.doneLeft_?a.doneRight_?(this.stateStack.shift(),this.stateStack[0].value=a.value):"&&"==b.operator&&!a.value.toBoolean()||"||"==b.operator&&a.value.toBoolean()?(this.stateStack.shift(),this.stateStack[0].value=a.value):(a.doneRight_=!0,this.stateStack.unshift({node:b.right})):(a.doneLeft_=!0,this.stateStack.unshift({node:b.left}))};
|
||||
Interpreter.prototype.stepMemberExpression=function(){var a=this.stateStack[0],b=a.node;a.doneObject_?a.doneProperty_?(this.stateStack.shift(),a.components?this.stateStack[0].value=[a.object,a.value]:(b=this.getProperty(a.object,a.value),b.isGetter?(b.isGetter=!1,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.object,func_:b,doneArgs_:!0,arguments:[]})):this.stateStack[0].value=b)):(a.doneProperty_=!0,a.object=a.value,this.stateStack.unshift({node:b.property,components:!b.computed})):
|
||||
(a.doneObject_=!0,this.stateStack.unshift({node:b.object}))};Interpreter.prototype.stepNewExpression=Interpreter.prototype.stepCallExpression;
|
||||
Interpreter.prototype.stepObjectExpression=function(){var a=this.stateStack[0],b=a.node,c=a.valueToggle,d=a.n||0;a.object?c?a.key=a.value:(a.properties[a.key]||(a.properties[a.key]={}),a.properties[a.key][a.kind]=a.value):(a.object=this.createObject(this.OBJECT),a.properties=Object.create(null));if(b.properties[d])c?(a.n=d+1,this.stateStack.unshift({node:b.properties[d].value})):(a.kind=b.properties[d].kind,this.stateStack.unshift({node:b.properties[d].key,components:!0})),a.valueToggle=!c;else{for(var g in a.properties)b=
|
||||
a.properties[g],"get"in b||"set"in b?(b={configurable:!0,enumerable:!0,get:b.get,set:b.set},this.setProperty(a.object,g,null,b)):this.setProperty(a.object,g,b.init);this.stateStack.shift();this.stateStack[0].value=a.object}};Interpreter.prototype.stepProgram=Interpreter.prototype.stepBlockStatement;
|
||||
Interpreter.prototype.stepMemberExpression=function(){var a=this.stateStack[0],b=a.node;a.doneObject_?a.doneProperty_?(this.stateStack.shift(),a.components?this.stateStack[0].value=[a.object,a.value]:(b=this.getProperty(a.object,a.value))?b.isGetter?(b.isGetter=!1,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.object,func_:b,doneArgs_:!0,arguments:[]})):this.stateStack[0].value=b:(this.stateStack.unshift({}),this.throwException(this.TYPE_ERROR,"Cannot read property '"+
|
||||
a.value+"' of "+a.object.toString()))):(a.doneProperty_=!0,a.object=a.value,this.stateStack.unshift({node:b.property,components:!b.computed})):(a.doneObject_=!0,this.stateStack.unshift({node:b.object}))};Interpreter.prototype.stepNewExpression=Interpreter.prototype.stepCallExpression;
|
||||
Interpreter.prototype.stepObjectExpression=function(){var a=this.stateStack[0],b=a.node,c=a.valueToggle,d=a.n||0;a.object?c?a.key=a.value:(a.properties[a.key]||(a.properties[a.key]={}),a.properties[a.key][a.kind]=a.value):(a.object=this.createObject(this.OBJECT),a.properties=Object.create(null));if(b.properties[d])c?(a.n=d+1,this.stateStack.unshift({node:b.properties[d].value})):(a.kind=b.properties[d].kind,this.stateStack.unshift({node:b.properties[d].key,components:!0})),a.valueToggle=!c;else{for(var h in a.properties)b=
|
||||
a.properties[h],"get"in b||"set"in b?(b={configurable:!0,enumerable:!0,get:b.get,set:b.set},this.setProperty(a.object,h,null,b)):this.setProperty(a.object,h,b.init);this.stateStack.shift();this.stateStack[0].value=a.object}};Interpreter.prototype.stepProgram=Interpreter.prototype.stepBlockStatement;
|
||||
Interpreter.prototype.stepReturnStatement=function(){var a=this.stateStack[0],b=a.node;if(b.argument&&!a.done)a.done=!0,this.stateStack.unshift({node:b.argument});else{b=a.value||this.UNDEFINED;do{this.stateStack.shift();if(0==this.stateStack.length)throw SyntaxError("Illegal return statement");a=this.stateStack[0]}while("CallExpression"!=a.node.type&&"NewExpression"!=a.node.type);a.value=b}};
|
||||
Interpreter.prototype.stepSequenceExpression=function(){var a=this.stateStack[0],b=a.node,c=a.n||0;b.expressions[c]?(a.n=c+1,this.stateStack.unshift({node:b.expressions[c]})):(this.stateStack.shift(),this.stateStack[0].value=a.value)};
|
||||
Interpreter.prototype.stepSwitchStatement=function(){var a=this.stateStack[0];a.checked=a.checked||[];a.isSwitch=!0;if(a.test){a.switchValue||(a.switchValue=a.value);var b=a.index||0,c=a.node.cases[b];if(c)if(a.done||a.checked[b]||!c.test){if(a.done||!c.test||0==this.comp(a.value,a.switchValue)){a.done=!0;var d=a.n||0;if(c.consequent[d]){this.stateStack.unshift({node:c.consequent[d]});a.n=d+1;return}}a.n=0;a.index=b+1}else a.checked[b]=!0,this.stateStack.unshift({node:c.test});else this.stateStack.shift()}else a.test=
|
||||
!0,this.stateStack.unshift({node:a.node.discriminant})};Interpreter.prototype.stepThisExpression=function(){this.stateStack.shift();for(var a=0;a<this.stateStack.length;a++)if(this.stateStack[a].thisExpression){this.stateStack[0].value=this.stateStack[a].thisExpression;return}throw Error("No this expression found.");};Interpreter.prototype.stepThrowStatement=function(){var a=this.stateStack[0],b=a.node;a.argument?this.throwException(a.value):(a.argument=!0,this.stateStack.unshift({node:b.argument}))};
|
||||
Interpreter.prototype.stepTryStatement=function(){var a=this.stateStack[0],b=a.node;a.doneBlock?!a.doneFinalizer&&b.finalizer?(a.doneFinalizer=!0,this.stateStack.unshift({node:b.finalizer})):this.stateStack.shift():(a.doneBlock=!0,this.stateStack.unshift({node:b.block}))};
|
||||
Interpreter.prototype.stepTryStatement=function(){var a=this.stateStack[0],b=a.node;a.doneBlock?a.throwValue&&!a.doneHandler&&b.handler?(a.doneHandler=!0,this.stateStack.unshift({node:b.handler,throwValue:a.throwValue}),a.throwValue=null):!a.doneFinalizer&&b.finalizer?(a.doneFinalizer=!0,this.stateStack.unshift({node:b.finalizer})):a.throwValue?this.executeException(a.throwValue):this.stateStack.shift():(a.doneBlock=!0,this.stateStack.unshift({node:b.block}))};
|
||||
Interpreter.prototype.stepUnaryExpression=function(){var a=this.stateStack[0],b=a.node;if(a.done){this.stateStack.shift();if("-"==b.operator)b=-a.value.toNumber();else if("+"==b.operator)b=a.value.toNumber();else if("!"==b.operator)b=!a.value.toBoolean();else if("~"==b.operator)b=~a.value.toNumber();else if("delete"==b.operator||"typeof"==b.operator){if(a.value.length)var c=a.value[0],a=a.value[1];else c=this.getScope(),a=a.value;b="delete"==b.operator?this.deleteProperty(c,a):this.getProperty(c,
|
||||
a).type}else if("void"==b.operator)b=void 0;else throw SyntaxError("Unknown unary operator: "+b.operator);this.stateStack[0].value=this.createPrimitive(b)}else{a.done=!0;c={node:b.argument};if("delete"==b.operator||"typeof"==b.operator)c.components=!0;this.stateStack.unshift(c)}};
|
||||
Interpreter.prototype.stepUpdateExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneLeft){a.leftSide||(a.leftSide=a.value);a.doneGetter_&&(a.leftValue=a.value);if(!a.doneGetter_&&(a.leftValue=this.getValue(a.leftSide),a.leftValue.isGetter)){a.leftValue.isGetter=!1;a.doneGetter_=!0;this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:a.leftValue,doneArgs_:!0,arguments:[]});return}if(a.doneSetter_)this.stateStack.shift(),this.stateStack[0].value=
|
||||
a.doneSetter_;else{var c=a.leftValue.toNumber(),d;if("++"==b.operator)d=this.createPrimitive(c+1);else if("--"==b.operator)d=this.createPrimitive(c-1);else throw SyntaxError("Unknown update expression: "+b.operator);b=b.prefix?d:this.createPrimitive(c);(c=this.setValue(a.leftSide,d))?(a.doneSetter_=b,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:c,doneArgs_:!0,arguments:[d]})):(this.stateStack.shift(),this.stateStack[0].value=b)}}else a.doneLeft=
|
||||
!0,this.stateStack.unshift({node:b.argument,components:!0})};Interpreter.prototype.stepVariableDeclaration=function(){var a=this.stateStack[0],b=a.node,c=a.n||0;b.declarations[c]?(a.n=c+1,this.stateStack.unshift({node:b.declarations[c]})):this.stateStack.shift()};Interpreter.prototype.stepVariableDeclarator=function(){var a=this.stateStack[0],b=a.node;b.init&&!a.done?(a.done=!0,this.stateStack.unshift({node:b.init})):(b.init&&this.setValue(this.createPrimitive(b.id.name),a.value),this.stateStack.shift())};
|
||||
Interpreter.prototype.stepUpdateExpression=function(){var a=this.stateStack[0],b=a.node;if(a.doneLeft){a.leftSide||(a.leftSide=a.value);a.doneGetter_&&(a.leftValue=a.value);if(!a.doneGetter_){a.leftValue=this.getValue(a.leftSide);if(!a.leftValue)return;if(a.leftValue.isGetter){a.leftValue.isGetter=!1;a.doneGetter_=!0;this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:a.leftValue,doneArgs_:!0,arguments:[]});return}}if(a.doneSetter_)this.stateStack.shift(),
|
||||
this.stateStack[0].value=a.doneSetter_;else{var c=a.leftValue.toNumber(),d;if("++"==b.operator)d=this.createPrimitive(c+1);else if("--"==b.operator)d=this.createPrimitive(c-1);else throw SyntaxError("Unknown update expression: "+b.operator);b=b.prefix?d:this.createPrimitive(c);(c=this.setValue(a.leftSide,d))?(a.doneSetter_=b,this.stateStack.unshift({node:{type:"CallExpression"},doneCallee_:!0,funcThis_:a.leftSide[0],func_:c,doneArgs_:!0,arguments:[d]})):(this.stateStack.shift(),this.stateStack[0].value=
|
||||
b)}}else a.doneLeft=!0,this.stateStack.unshift({node:b.argument,components:!0})};Interpreter.prototype.stepVariableDeclaration=function(){var a=this.stateStack[0],b=a.node,c=a.n||0;b.declarations[c]?(a.n=c+1,this.stateStack.unshift({node:b.declarations[c]})):this.stateStack.shift()};
|
||||
Interpreter.prototype.stepVariableDeclarator=function(){var a=this.stateStack[0],b=a.node;b.init&&!a.done?(a.done=!0,this.stateStack.unshift({node:b.init})):(b.init&&this.setValue(this.createPrimitive(b.id.name),a.value),this.stateStack.shift())};
|
||||
Interpreter.prototype.stepWithStatement=function(){var a=this.stateStack[0],b=a.node;a.doneObject?a.doneBody?this.stateStack.shift():(a.doneBody=!0,a=this.createSpecialScope(this.getScope(),a.value),this.stateStack.unshift({node:b.body,scope:a})):(a.doneObject=!0,this.stateStack.unshift({node:b.object}))};Interpreter.prototype.stepWhileStatement=Interpreter.prototype.stepDoWhileStatement;this.Interpreter=Interpreter;Interpreter.prototype.appendCode=Interpreter.prototype.appendCode;
|
||||
Interpreter.prototype.createAsyncFunction=Interpreter.prototype.createAsyncFunction;Interpreter.prototype.step=Interpreter.prototype.step;Interpreter.prototype.run=Interpreter.prototype.run;
|
||||
|
||||
Reference in New Issue
Block a user