Comparing version 1.4.1 to 1.4.2
@@ -16,3 +16,3 @@ "use strict"; | ||
var version = "1.4.1"; | ||
var version = "1.4.2"; | ||
@@ -195,3 +195,7 @@ function defineFunctionName(func, name) { | ||
Error: Error, | ||
URIError: URIError, | ||
TypeError: TypeError, | ||
RangeError: RangeError, | ||
SyntaxError: SyntaxError, | ||
ReferenceError: ReferenceError, | ||
Math: Math, | ||
@@ -397,4 +401,7 @@ parseInt: parseInt, | ||
this.isRunning = true; | ||
var bodyClosure = this.createClosure(node); // add declares to data | ||
var bodyClosure = this.createClosure(node); //reset timeout | ||
this.execStartTime = Date.now(); | ||
this.execEndTime = this.execStartTime; // add declares to data | ||
this.addDeclarationsToScope(this.collectDeclVars, this.collectDeclFuncs, this.getCurrentScope()); // reset | ||
@@ -1269,60 +1276,46 @@ | ||
if (node.operator !== "=") { | ||
// var1(undefined) += 1 | ||
// if a is undefined | ||
// a += 1 | ||
_this15.assertVariable(data, name, node); | ||
} | ||
var value = data[name]; | ||
switch (node.operator) { | ||
case "=": | ||
value = rightValue; | ||
break; | ||
return data[name] = rightValue; | ||
case "+=": | ||
value += rightValue; | ||
break; | ||
return data[name] += rightValue; | ||
case "-=": | ||
value -= rightValue; | ||
break; | ||
return data[name] -= rightValue; | ||
case "*=": | ||
value *= rightValue; | ||
break; | ||
return data[name] *= rightValue; | ||
// case "**=": | ||
// data[name]: Getter may be triggered | ||
// return (data[name] = Math.pow(data[name], rightValue)); | ||
case "**=": | ||
value = Math.pow(value, rightValue); | ||
break; | ||
case "/=": | ||
value /= rightValue; | ||
break; | ||
return data[name] /= rightValue; | ||
case "%=": | ||
value %= rightValue; | ||
break; | ||
return data[name] %= rightValue; | ||
case "<<=": | ||
value <<= rightValue; | ||
break; | ||
return data[name] <<= rightValue; | ||
case ">>=": | ||
value >>= rightValue; | ||
break; | ||
return data[name] >>= rightValue; | ||
case ">>>=": | ||
value >>>= rightValue; | ||
break; | ||
return data[name] >>>= rightValue; | ||
case "&=": | ||
value &= rightValue; | ||
break; | ||
return data[name] &= rightValue; | ||
case "^=": | ||
value ^= rightValue; | ||
break; | ||
return data[name] ^= rightValue; | ||
case "|=": | ||
value |= rightValue; | ||
break; | ||
return data[name] |= rightValue; | ||
@@ -1332,5 +1325,2 @@ default: | ||
} | ||
data[name] = value; | ||
return value; | ||
}; | ||
@@ -1337,0 +1327,0 @@ } // function test(){} |
import _construct from "@babel/runtime/helpers/construct"; | ||
import { parse } from "acorn"; | ||
import { Messages, InterruptThrowError, InterruptThrowReferenceError, InterruptThrowSyntaxError } from "./messages"; | ||
var version = "1.4.1"; | ||
var version = "1.4.2"; | ||
@@ -182,3 +182,7 @@ function defineFunctionName(func, name) { | ||
Error: Error, | ||
URIError: URIError, | ||
TypeError: TypeError, | ||
RangeError: RangeError, | ||
SyntaxError: SyntaxError, | ||
ReferenceError: ReferenceError, | ||
Math: Math, | ||
@@ -384,4 +388,7 @@ parseInt: parseInt, | ||
this.isRunning = true; | ||
var bodyClosure = this.createClosure(node); // add declares to data | ||
var bodyClosure = this.createClosure(node); //reset timeout | ||
this.execStartTime = Date.now(); | ||
this.execEndTime = this.execStartTime; // add declares to data | ||
this.addDeclarationsToScope(this.collectDeclVars, this.collectDeclFuncs, this.getCurrentScope()); // reset | ||
@@ -1256,60 +1263,46 @@ | ||
if (node.operator !== "=") { | ||
// var1(undefined) += 1 | ||
// if a is undefined | ||
// a += 1 | ||
_this15.assertVariable(data, name, node); | ||
} | ||
var value = data[name]; | ||
switch (node.operator) { | ||
case "=": | ||
value = rightValue; | ||
break; | ||
return data[name] = rightValue; | ||
case "+=": | ||
value += rightValue; | ||
break; | ||
return data[name] += rightValue; | ||
case "-=": | ||
value -= rightValue; | ||
break; | ||
return data[name] -= rightValue; | ||
case "*=": | ||
value *= rightValue; | ||
break; | ||
return data[name] *= rightValue; | ||
// case "**=": | ||
// data[name]: Getter may be triggered | ||
// return (data[name] = Math.pow(data[name], rightValue)); | ||
case "**=": | ||
value = Math.pow(value, rightValue); | ||
break; | ||
case "/=": | ||
value /= rightValue; | ||
break; | ||
return data[name] /= rightValue; | ||
case "%=": | ||
value %= rightValue; | ||
break; | ||
return data[name] %= rightValue; | ||
case "<<=": | ||
value <<= rightValue; | ||
break; | ||
return data[name] <<= rightValue; | ||
case ">>=": | ||
value >>= rightValue; | ||
break; | ||
return data[name] >>= rightValue; | ||
case ">>>=": | ||
value >>>= rightValue; | ||
break; | ||
return data[name] >>>= rightValue; | ||
case "&=": | ||
value &= rightValue; | ||
break; | ||
return data[name] &= rightValue; | ||
case "^=": | ||
value ^= rightValue; | ||
break; | ||
return data[name] ^= rightValue; | ||
case "|=": | ||
value |= rightValue; | ||
break; | ||
return data[name] |= rightValue; | ||
@@ -1319,5 +1312,2 @@ default: | ||
} | ||
data[name] = value; | ||
return value; | ||
}; | ||
@@ -1324,0 +1314,0 @@ } // function test(){} |
@@ -148,3 +148,7 @@ import { parse } from "acorn"; | ||
Error, | ||
URIError, | ||
TypeError, | ||
RangeError, | ||
SyntaxError, | ||
ReferenceError, | ||
Math, | ||
@@ -307,2 +311,5 @@ parseInt, | ||
const bodyClosure = this.createClosure(node); | ||
//reset timeout | ||
this.execStartTime = Date.now(); | ||
this.execEndTime = this.execStartTime; | ||
// add declares to data | ||
@@ -975,51 +982,37 @@ this.addDeclarationsToScope(this.collectDeclVars, this.collectDeclFuncs, this.getCurrentScope()); | ||
if (node.operator !== "=") { | ||
// var1(undefined) += 1 | ||
// if a is undefined | ||
// a += 1 | ||
this.assertVariable(data, name, node); | ||
} | ||
let value = data[name]; | ||
switch (node.operator) { | ||
case "=": | ||
value = rightValue; | ||
break; | ||
return (data[name] = rightValue); | ||
case "+=": | ||
value += rightValue; | ||
break; | ||
return (data[name] += rightValue); | ||
case "-=": | ||
value -= rightValue; | ||
break; | ||
return (data[name] -= rightValue); | ||
case "*=": | ||
value *= rightValue; | ||
break; | ||
case "**=": | ||
value = Math.pow(value, rightValue); | ||
break; | ||
return (data[name] *= rightValue); | ||
// case "**=": | ||
// data[name]: Getter may be triggered | ||
// return (data[name] = Math.pow(data[name], rightValue)); | ||
case "/=": | ||
value /= rightValue; | ||
break; | ||
return (data[name] /= rightValue); | ||
case "%=": | ||
value %= rightValue; | ||
break; | ||
return (data[name] %= rightValue); | ||
case "<<=": | ||
value <<= rightValue; | ||
break; | ||
return (data[name] <<= rightValue); | ||
case ">>=": | ||
value >>= rightValue; | ||
break; | ||
return (data[name] >>= rightValue); | ||
case ">>>=": | ||
value >>>= rightValue; | ||
break; | ||
return (data[name] >>>= rightValue); | ||
case "&=": | ||
value &= rightValue; | ||
break; | ||
return (data[name] &= rightValue); | ||
case "^=": | ||
value ^= rightValue; | ||
break; | ||
return (data[name] ^= rightValue); | ||
case "|=": | ||
value |= rightValue; | ||
break; | ||
return (data[name] |= rightValue); | ||
default: | ||
throw this.createInternalThrowError(Messages.AssignmentExpressionSyntaxError, node.type, node); | ||
} | ||
data[name] = value; | ||
return value; | ||
}; | ||
@@ -1026,0 +1019,0 @@ } |
{ | ||
"name": "eval5", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "A JavaScript interpreter written in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
1058758
39
12603