Comparing version 1.0.6 to 1.0.7
@@ -41,3 +41,2 @@ import { MessageItem } from "./messages"; | ||
collectDeclarations: CollectDeclarations; | ||
protected error: Error | null; | ||
protected isVarDeclMode: boolean; | ||
@@ -50,5 +49,5 @@ protected lastExecNode: Node | null; | ||
isInterruptThrow<T>(err: T): boolean; | ||
setCurrentContext(ctx: Context): void; | ||
setCurrentScope(scope: Scope): void; | ||
initEnvironment(ctx: Context): void; | ||
protected setCurrentContext(ctx: Context): void; | ||
protected setCurrentScope(scope: Scope): void; | ||
protected initEnvironment(ctx: Context): void; | ||
evaluate(code?: string, ctx?: Context): any; | ||
@@ -55,0 +54,0 @@ evaluateNode(node: ESTree.Program, source?: string, ctx?: Context): any; |
@@ -15,5 +15,2 @@ import _construct from "@babel/runtime/helpers/construct"; | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
var FunctionNameSymbol = Symbol("name"); | ||
var FunctionLengthSymbol = Symbol("length"); | ||
var isFunctionSymbol = Symbol("isFunction"); | ||
var Break = Symbol("Break"); | ||
@@ -96,3 +93,2 @@ var Continue = Symbol("Continue"); | ||
this.collectDeclarations = {}; | ||
this.error = null; | ||
this.isVarDeclMode = false; | ||
@@ -132,3 +128,2 @@ this.lastExecNode = null; | ||
this.execEndTime = this.execStartTime; | ||
this.error = null; | ||
}; | ||
@@ -801,9 +796,3 @@ | ||
defineFunctionName(func, name); // Object.defineProperty(func, "name", { | ||
// value: name, | ||
// writable: false, | ||
// enumerable: false, | ||
// configurable: true, | ||
// }); | ||
defineFunctionName(func, name); | ||
Object.defineProperty(func, "length", { | ||
@@ -814,21 +803,3 @@ value: paramLength, | ||
configurable: true | ||
}); // Object.defineProperty(func, FunctionLengthSymbol, { | ||
// value: paramLength, | ||
// writable: false, | ||
// configurable: false, | ||
// enumerable: false, | ||
// }); | ||
// Object.defineProperty(func, FunctionNameSymbol, { | ||
// value: name, | ||
// writable: false, | ||
// configurable: false, | ||
// enumerable: false, | ||
// }); | ||
// Object.defineProperty(func, isFunctionSymbol, { | ||
// value: true, | ||
// writable: false, | ||
// configurable: false, | ||
// enumerable: false, | ||
// }); | ||
}); | ||
Object.defineProperty(func, "toString", { | ||
@@ -885,11 +856,3 @@ value: function value() { | ||
var obj = objectGetter(); | ||
var key = keyGetter(); // get function.length | ||
// if (obj && obj[isFunctionSymbol] && key === "length") { | ||
// key = FunctionLengthSymbol; | ||
// } | ||
// get function.name | ||
// if (obj && obj[isFunctionSymbol] && key === "name") { | ||
// key = FunctionNameSymbol; | ||
// } | ||
var key = keyGetter(); | ||
return obj[key]; | ||
@@ -1413,6 +1376,11 @@ }; | ||
} | ||
} catch (e) { | ||
reset(); // save catch throw error | ||
} catch (err) { | ||
reset(); | ||
throwError = e; | ||
if (_this21.isInterruptThrow(err)) { | ||
throw err; | ||
} // save catch throw error | ||
throwError = err; | ||
} | ||
@@ -1432,6 +1400,11 @@ } | ||
} catch (e) { | ||
reset(); // save finally throw error | ||
} catch (err) { | ||
reset(); | ||
throwError = e; | ||
if (_this21.isInterruptThrow(err)) { | ||
throw err; | ||
} // save finally throw error | ||
throwError = err; | ||
} // if (finalReturn instanceof Return) { | ||
@@ -1438,0 +1411,0 @@ // result = finalReturn; |
@@ -41,3 +41,2 @@ import { MessageItem } from "./messages"; | ||
collectDeclarations: CollectDeclarations; | ||
protected error: Error | null; | ||
protected isVarDeclMode: boolean; | ||
@@ -50,5 +49,5 @@ protected lastExecNode: Node | null; | ||
isInterruptThrow<T>(err: T): boolean; | ||
setCurrentContext(ctx: Context): void; | ||
setCurrentScope(scope: Scope): void; | ||
initEnvironment(ctx: Context): void; | ||
protected setCurrentContext(ctx: Context): void; | ||
protected setCurrentScope(scope: Scope): void; | ||
protected initEnvironment(ctx: Context): void; | ||
evaluate(code?: string, ctx?: Context): any; | ||
@@ -55,0 +54,0 @@ evaluateNode(node: ESTree.Program, source?: string, ctx?: Context): any; |
@@ -26,5 +26,2 @@ "use strict"; | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
var FunctionNameSymbol = Symbol("name"); | ||
var FunctionLengthSymbol = Symbol("length"); | ||
var isFunctionSymbol = Symbol("isFunction"); | ||
var Break = Symbol("Break"); | ||
@@ -107,3 +104,2 @@ var Continue = Symbol("Continue"); | ||
this.collectDeclarations = {}; | ||
this.error = null; | ||
this.isVarDeclMode = false; | ||
@@ -143,3 +139,2 @@ this.lastExecNode = null; | ||
this.execEndTime = this.execStartTime; | ||
this.error = null; | ||
}; | ||
@@ -812,9 +807,3 @@ | ||
defineFunctionName(func, name); // Object.defineProperty(func, "name", { | ||
// value: name, | ||
// writable: false, | ||
// enumerable: false, | ||
// configurable: true, | ||
// }); | ||
defineFunctionName(func, name); | ||
Object.defineProperty(func, "length", { | ||
@@ -825,21 +814,3 @@ value: paramLength, | ||
configurable: true | ||
}); // Object.defineProperty(func, FunctionLengthSymbol, { | ||
// value: paramLength, | ||
// writable: false, | ||
// configurable: false, | ||
// enumerable: false, | ||
// }); | ||
// Object.defineProperty(func, FunctionNameSymbol, { | ||
// value: name, | ||
// writable: false, | ||
// configurable: false, | ||
// enumerable: false, | ||
// }); | ||
// Object.defineProperty(func, isFunctionSymbol, { | ||
// value: true, | ||
// writable: false, | ||
// configurable: false, | ||
// enumerable: false, | ||
// }); | ||
}); | ||
Object.defineProperty(func, "toString", { | ||
@@ -896,11 +867,3 @@ value: function value() { | ||
var obj = objectGetter(); | ||
var key = keyGetter(); // get function.length | ||
// if (obj && obj[isFunctionSymbol] && key === "length") { | ||
// key = FunctionLengthSymbol; | ||
// } | ||
// get function.name | ||
// if (obj && obj[isFunctionSymbol] && key === "name") { | ||
// key = FunctionNameSymbol; | ||
// } | ||
var key = keyGetter(); | ||
return obj[key]; | ||
@@ -1424,6 +1387,11 @@ }; | ||
} | ||
} catch (e) { | ||
reset(); // save catch throw error | ||
} catch (err) { | ||
reset(); | ||
throwError = e; | ||
if (_this21.isInterruptThrow(err)) { | ||
throw err; | ||
} // save catch throw error | ||
throwError = err; | ||
} | ||
@@ -1443,6 +1411,11 @@ } | ||
} catch (e) { | ||
reset(); // save finally throw error | ||
} catch (err) { | ||
reset(); | ||
throwError = e; | ||
if (_this21.isInterruptThrow(err)) { | ||
throw err; | ||
} // save finally throw error | ||
throwError = err; | ||
} // if (finalReturn instanceof Return) { | ||
@@ -1449,0 +1422,0 @@ // result = finalReturn; |
{ | ||
"name": "eval5", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A JavaScript interpreter, written completely in JavaScript", | ||
@@ -9,3 +9,3 @@ "main": "lib/index.js", | ||
"start": "npm-run-all clean mkdir -p ts:watch babel", | ||
"build": "npm-run-all clean mkdir ts cjs esm bundle", | ||
"build": "npm-run-all clean mkdir ts cjs esm bundle bundle:min", | ||
"mkdir": "mkdirp dest", | ||
@@ -18,3 +18,4 @@ "clean": "rimraf dest", | ||
"esm": "transform-es dest -t esm -d esm -c", | ||
"bundle": "packez bundle ./src/index.ts -d umd", | ||
"bundle": "packez bundle ./src/index.ts -d umd -c", | ||
"bundle:min": "packez bundle ./src/index.ts -d umd --state min", | ||
"test": "jest" | ||
@@ -21,0 +22,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
946313
38
10244