diff --git a/src/fn_call.rs b/src/fn_call.rs index c2b594d3..f4c3c0e6 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -607,6 +607,7 @@ impl Engine { } // Does a scripted function exist? + #[cfg(not(feature = "no_function"))] #[inline(always)] pub(crate) fn has_script_fn( &self, @@ -734,6 +735,7 @@ impl Engine { } // Scripted function call? + #[cfg(not(feature = "no_function"))] let hash_script = if hash.is_native_only() { None } else { diff --git a/src/optimize.rs b/src/optimize.rs index 7c863747..3cf81224 100644 --- a/src/optimize.rs +++ b/src/optimize.rs @@ -240,20 +240,26 @@ fn optimize_stmt_block( .find_map(|(i, stmt)| match stmt { stmt if !is_pure(stmt) => Some(i), - Stmt::Noop(_) | Stmt::Return(_, None, _) | Stmt::Export(_, _) | Stmt::Share(_) => { - None - } + Stmt::Noop(_) | Stmt::Return(_, None, _) => None, Stmt::Let(e, _, _, _) | Stmt::Const(e, _, _, _) | Stmt::Expr(e) | Stmt::Return(_, Some(e), _) - | Stmt::Import(e, _, _) if e.is_constant() => { None } + #[cfg(not(feature = "no_module"))] + Stmt::Import(e, _, _) if e.is_constant() => None, + + #[cfg(not(feature = "no_module"))] + Stmt::Export(_, _) => None, + + #[cfg(not(feature = "no_closure"))] + Stmt::Share(_) => None, + _ => Some(i), }) .map_or(0, |n| statements.len() - n); @@ -370,8 +376,6 @@ fn optimize_stmt_block( state.set_dirty(); } - println!("{:?}", statements); - statements.shrink_to_fit(); statements }