More code refactor.

This commit is contained in:
Stephen Chung
2022-11-25 20:42:16 +08:00
parent fbe30b8d0e
commit d645d8271c
30 changed files with 422 additions and 434 deletions

View File

@@ -51,20 +51,14 @@ impl Engine {
) -> AST {
let mut ast = ast;
#[cfg(not(feature = "no_function"))]
let functions = ast
.shared_lib()
.iter_fn()
.filter(|f| f.func.is_script())
.map(|f| f.func.get_script_fn_def().unwrap().clone())
.collect();
let mut _new_ast = crate::optimizer::optimize_into_ast(
self,
let mut _new_ast = self.optimize_into_ast(
scope,
ast.take_statements(),
#[cfg(not(feature = "no_function"))]
functions,
ast.shared_lib()
.iter_fn()
.map(|f| f.func.get_script_fn_def().expect("`ScriptFnDef").clone())
.collect(),
optimization_level,
);