Build Module type plus engine hooks.

This commit is contained in:
Stephen Chung
2020-05-05 15:00:10 +08:00
parent c03b162b7e
commit 38e717a838
14 changed files with 249 additions and 134 deletions

View File

@@ -13,9 +13,7 @@ use crate::token::Position;
use crate::stdlib::{
boxed::Box,
collections::HashMap,
rc::Rc,
string::{String, ToString},
sync::Arc,
vec,
vec::Vec,
};
@@ -747,16 +745,13 @@ pub fn optimize_into_ast(
.collect(),
);
AST(
AST::new(
match level {
OptimizationLevel::None => statements,
OptimizationLevel::Simple | OptimizationLevel::Full => {
optimize(statements, engine, &scope, &fn_lib, level)
}
},
#[cfg(feature = "sync")]
Arc::new(lib),
#[cfg(not(feature = "sync"))]
Rc::new(lib),
lib,
)
}