Fix build.

This commit is contained in:
Stephen Chung 2022-12-06 23:45:12 +08:00
parent 90998f4f14
commit e400b3627c
2 changed files with 12 additions and 1 deletions

View File

@ -253,6 +253,17 @@ impl fmt::Debug for Module {
}
}
#[cfg(not(feature = "no_function"))]
impl<T: IntoIterator<Item = Shared<crate::ast::ScriptFnDef>>> From<T> for Module {
fn from(iter: T) -> Self {
let mut module = Self::new();
iter.into_iter().for_each(|fn_def| {
module.set_script_fn(fn_def);
});
module
}
}
impl<M: AsRef<Module>> Add<M> for &Module {
type Output = Module;

View File

@ -3884,7 +3884,7 @@ impl Engine {
return Ok(AST::new(
statements,
#[cfg(not(feature = "no_function"))]
functions.into_iter().map(|(.., v)| v).collect(),
crate::Module::from(functions.into_iter().map(|(.., v)| v)),
));
}