diff --git a/src/ast.rs b/src/ast.rs index de1d613e..3f4e273f 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -684,10 +684,9 @@ impl AST { } /// Recursively walk the [`AST`], including function bodies (if any). #[cfg(not(feature = "internals"))] + #[cfg(not(feature = "no_module"))] #[inline(always)] pub(crate) fn walk(&self, on_node: &mut impl FnMut(&[ASTNode])) { - let mut path = Default::default(); - self.statements() .iter() .chain({ @@ -700,15 +699,13 @@ impl AST { crate::stdlib::iter::empty() } }) - .for_each(|stmt| stmt.walk(&mut path, on_node)); + .for_each(|stmt| stmt.walk(&mut Default::default(), on_node)); } /// _(INTERNALS)_ Recursively walk the [`AST`], including function bodies (if any). /// Exported under the `internals` feature only. #[cfg(feature = "internals")] #[inline(always)] pub fn walk(&self, on_node: &mut impl FnMut(&[ASTNode])) { - let mut path = Default::default(); - self.statements() .iter() .chain({ @@ -721,7 +718,7 @@ impl AST { crate::stdlib::iter::empty() } }) - .for_each(|stmt| stmt.walk(&mut path, on_node)); + .for_each(|stmt| stmt.walk(&mut Default::default(), on_node)); } } diff --git a/src/engine_api.rs b/src/engine_api.rs index 9efa0c7e..db3e3efa 100644 --- a/src/engine_api.rs +++ b/src/engine_api.rs @@ -1963,7 +1963,7 @@ impl Engine { /// )); /// /// let mut ast = engine.compile(r#"let x = "hello"; debug(x);"#)?; - /// ast.set_source(Some("world")); + /// ast.set_source("world"); /// engine.consume_ast(&ast)?; /// /// assert_eq!(*result.read().unwrap(), r#"world @ 1:18 > "hello""#);