Comparing version 2.1.0 to 2.1.1
@@ -15,6 +15,2 @@ import Visitor from './visitor.js'; | ||
/** | ||
* Generates an AST from the input. | ||
*/ | ||
parseScript(input: string): import("../acorn.js").ExtendNode<import("estree").Program>; | ||
/** | ||
* Evaluates the program. | ||
@@ -24,2 +20,6 @@ * @returns The result of the last statement in the program. | ||
evaluate(input: string): any; | ||
/** | ||
* Generates an AST from the input. | ||
*/ | ||
static parseScript(input: string): import("../acorn.js").ExtendNode<import("estree").Program>; | ||
} |
@@ -44,7 +44,9 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
/** | ||
* Generates an AST from the input. | ||
* Evaluates the program. | ||
* @returns The result of the last statement in the program. | ||
*/ | ||
parseScript(input) { | ||
evaluate(input) { | ||
try { | ||
return parse(input, { ecmaVersion: 2020 }); | ||
const program = parse(input, { ecmaVersion: 2020 }); | ||
__classPrivateFieldSet(this, _Jinter_ast, program.body, "f"); | ||
} | ||
@@ -54,11 +56,11 @@ catch (e) { | ||
} | ||
this.visitor.setAST(__classPrivateFieldGet(this, _Jinter_ast, "f")); | ||
return this.visitor.run(); | ||
} | ||
/** | ||
* Evaluates the program. | ||
* @returns The result of the last statement in the program. | ||
* Generates an AST from the input. | ||
*/ | ||
evaluate(input) { | ||
static parseScript(input) { | ||
try { | ||
const program = parse(input, { ecmaVersion: 2020 }); | ||
__classPrivateFieldSet(this, _Jinter_ast, program.body, "f"); | ||
return parse(input, { ecmaVersion: 2020 }); | ||
} | ||
@@ -68,6 +70,4 @@ catch (e) { | ||
} | ||
this.visitor.setAST(__classPrivateFieldGet(this, _Jinter_ast, "f")); | ||
return this.visitor.run(); | ||
} | ||
} | ||
_Jinter_ast = new WeakMap(); |
{ | ||
"name": "jintr", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "A tiny JavaScript interpreter written in TypeScript.", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
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
175314