Fix feature builds.

This commit is contained in:
Stephen Chung 2021-01-09 17:06:01 +08:00
parent f8b36a470a
commit e5b345bca4
2 changed files with 4 additions and 7 deletions

View File

@ -684,10 +684,9 @@ impl AST {
} }
/// Recursively walk the [`AST`], including function bodies (if any). /// Recursively walk the [`AST`], including function bodies (if any).
#[cfg(not(feature = "internals"))] #[cfg(not(feature = "internals"))]
#[cfg(not(feature = "no_module"))]
#[inline(always)] #[inline(always)]
pub(crate) fn walk(&self, on_node: &mut impl FnMut(&[ASTNode])) { pub(crate) fn walk(&self, on_node: &mut impl FnMut(&[ASTNode])) {
let mut path = Default::default();
self.statements() self.statements()
.iter() .iter()
.chain({ .chain({
@ -700,15 +699,13 @@ impl AST {
crate::stdlib::iter::empty() 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). /// _(INTERNALS)_ Recursively walk the [`AST`], including function bodies (if any).
/// Exported under the `internals` feature only. /// Exported under the `internals` feature only.
#[cfg(feature = "internals")] #[cfg(feature = "internals")]
#[inline(always)] #[inline(always)]
pub fn walk(&self, on_node: &mut impl FnMut(&[ASTNode])) { pub fn walk(&self, on_node: &mut impl FnMut(&[ASTNode])) {
let mut path = Default::default();
self.statements() self.statements()
.iter() .iter()
.chain({ .chain({
@ -721,7 +718,7 @@ impl AST {
crate::stdlib::iter::empty() crate::stdlib::iter::empty()
} }
}) })
.for_each(|stmt| stmt.walk(&mut path, on_node)); .for_each(|stmt| stmt.walk(&mut Default::default(), on_node));
} }
} }

View File

@ -1963,7 +1963,7 @@ impl Engine {
/// )); /// ));
/// ///
/// let mut ast = engine.compile(r#"let x = "hello"; debug(x);"#)?; /// let mut ast = engine.compile(r#"let x = "hello"; debug(x);"#)?;
/// ast.set_source(Some("world")); /// ast.set_source("world");
/// engine.consume_ast(&ast)?; /// engine.consume_ast(&ast)?;
/// ///
/// assert_eq!(*result.read().unwrap(), r#"world @ 1:18 > "hello""#); /// assert_eq!(*result.read().unwrap(), r#"world @ 1:18 > "hello""#);