Fix no_function build.

This commit is contained in:
Stephen Chung 2022-11-07 16:34:25 +08:00
parent b4529b6a64
commit cba914db95
2 changed files with 6 additions and 8 deletions

View File

@ -122,12 +122,12 @@ impl Engine {
let statements = ast.statements();
if !statements.is_empty() {
let lib = [
let lib: &[crate::Shared<crate::Module>] = &[
#[cfg(not(feature = "no_function"))]
AsRef::<crate::Shared<_>>::as_ref(ast).clone(),
AsRef::<crate::Shared<crate::Module>>::as_ref(ast).clone(),
];
let lib = if lib.first().map_or(true, |m| m.is_empty()) {
&lib[0..0]
&[][..]
} else {
&lib
};

View File

@ -150,17 +150,15 @@ impl FnPtr {
let mut arg_values = crate::StaticVec::new_const();
args.parse(&mut arg_values);
let lib = [
let lib: &[crate::Shared<crate::Module>] = &[
#[cfg(not(feature = "no_function"))]
AsRef::<crate::Shared<_>>::as_ref(ast).clone(),
AsRef::<crate::Shared<crate::Module>>::as_ref(ast).clone(),
];
let lib = if lib.first().map_or(true, |m| m.is_empty()) {
&lib[0..0]
&[][..]
} else {
&lib
};
#[cfg(feature = "no_function")]
let lib = &[];
#[allow(deprecated)]
let ctx = NativeCallContext::new(engine, self.fn_name(), lib);