createScriptFactory -> scopedEval
This commit is contained in:
2 files changed
+4
-5
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
Reference in new issue
Block a user