diff --git a/src/ast.rs b/src/ast.rs index 48ccb3bc..94281968 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -780,6 +780,7 @@ impl AST { /// let mut iter = ast.iter_literal_variables(true, false) /// .map(|(name, is_const, value)| (name, is_const, value.as_int().unwrap())); /// + /// # #[cfg(not(feature = "no_optimize"))] /// assert_eq!(iter.next(), Some(("A", true, 42))); /// assert_eq!(iter.next(), Some(("C", true, 999))); /// assert_eq!(iter.next(), None); @@ -793,6 +794,7 @@ impl AST { /// let mut iter = ast.iter_literal_variables(true, true) /// .map(|(name, is_const, value)| (name, is_const, value.as_int().unwrap())); /// + /// # #[cfg(not(feature = "no_optimize"))] /// assert_eq!(iter.next(), Some(("A", true, 42))); /// assert_eq!(iter.next(), Some(("b", false, 123))); /// assert_eq!(iter.next(), Some(("C", true, 999))); diff --git a/src/engine_api.rs b/src/engine_api.rs index c065b073..49595865 100644 --- a/src/engine_api.rs +++ b/src/engine_api.rs @@ -2070,9 +2070,11 @@ impl Engine { pub fn optimize_ast( &self, scope: &Scope, - mut ast: AST, + ast: AST, optimization_level: crate::OptimizationLevel, ) -> AST { + let mut ast = ast; + #[cfg(not(feature = "no_function"))] let lib = ast .lib()