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).
#[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));
}
}

View File

@ -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""#);