Fix no_function build.

This commit is contained in:
Stephen Chung
2020-09-24 23:32:54 +08:00
parent c4ec93080e
commit 6a53c446d3
2 changed files with 20 additions and 12 deletions

View File

@@ -7,10 +7,13 @@ use crate::engine::{
};
use crate::fn_native::FnPtr;
use crate::module::Module;
use crate::parser::{map_dynamic_to_expr, Expr, ReturnType, ScriptFnDef, Stmt, AST};
use crate::parser::{map_dynamic_to_expr, Expr, ScriptFnDef, Stmt, AST};
use crate::scope::{Entry as ScopeEntry, EntryType as ScopeEntryType, Scope};
use crate::utils::StaticVec;
#[cfg(not(feature = "no_function"))]
use crate::parser::ReturnType;
#[cfg(feature = "internals")]
use crate::parser::CustomExpr;
@@ -749,7 +752,8 @@ pub fn optimize_into_ast(
level
};
let lib = if cfg!(not(feature = "no_function")) {
#[cfg(not(feature = "no_function"))]
let lib = {
let mut module = Module::new();
if !level.is_none() {
@@ -811,10 +815,11 @@ pub fn optimize_into_ast(
}
module
} else {
Default::default()
};
#[cfg(feature = "no_function")]
let lib = Default::default();
AST::new(
match level {
OptimizationLevel::None => statements,