Fix internals build.

This commit is contained in:
Stephen Chung 2021-03-11 22:27:35 +08:00
parent 7b8a4c46e7
commit c2a34bd518

View File

@ -710,20 +710,22 @@ impl AST {
/// 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]) -> bool) -> bool {
self.statements() let path = &mut Default::default();
.iter()
.chain({ for stmt in self.statements() {
#[cfg(not(feature = "no_function"))] if !stmt.walk(path, on_node) {
{ return false;
self.iter_fn_def().flat_map(|f| f.body.statements.iter()) }
} }
#[cfg(feature = "no_function")] #[cfg(not(feature = "no_function"))]
{ for stmt in self.iter_fn_def().flat_map(|f| f.body.statements.iter()) {
crate::stdlib::iter::empty() if !stmt.walk(path, on_node) {
} return false;
}) }
.for_each(|stmt| stmt.walk(&mut Default::default(), on_node)); }
true
} }
} }