createScriptFactory -> scopedEval

This commit is contained in:
Thomas Weber committed 2020-07-14 18:55:02 -05:00
1 parent ed5e0bd40b
commit c141be971d
2 files changed
+4 -5

No files matched your search

+1 -1
View File
@@ -210,7 +210,7 @@ class ScriptCompiler {
compile() {
const compiledStack = this.compileStack(this.topBlock);
const script = this.createScriptFactory(compiledStack);
const fn = execute.createScriptFactory(script);
const fn = execute.scopedEval(script);
log.info(`[${this.target.getName()}] compiled script`, script);
return fn;
}
+3 -4
View File
@@ -428,11 +428,10 @@ const execute = (_thread) => {
};
/**
* Evaluate a continuation from its source code.
* Prepares the necessary environment.
* eval() some JS
* @param {string} source
*/
const createScriptFactory = (source) => {
const scopedEval = (source) => {
try {
return eval(source);
} catch (e) {
@@ -441,6 +440,6 @@ const createScriptFactory = (source) => {
}
};
execute.createScriptFactory = createScriptFactory;
execute.scopedEval = scopedEval;
module.exports = execute;