diff --git a/src/dynamic.rs b/src/dynamic.rs index 584e33ac..5e16cedf 100644 --- a/src/dynamic.rs +++ b/src/dynamic.rs @@ -1889,7 +1889,7 @@ impl From for Dynamic { fn from(value: Decimal) -> Self { Self(Union::Decimal( Box::new(value.into()), - DEFAULT_TAG, + DEFAULT_TAG_VALUE, ReadWrite, )) } diff --git a/src/fn_native.rs b/src/fn_native.rs index 6ca637d5..4f91cec5 100644 --- a/src/fn_native.rs +++ b/src/fn_native.rs @@ -109,14 +109,14 @@ impl<'a> NativeCallContext<'a> { pub const fn new_with_all_fields( engine: &'a Engine, fn_name: &'a str, - source: &'a Option<&str>, + source: Option<&'a str>, imports: &'a Imports, lib: &'a [&Module], ) -> Self { Self { engine, fn_name, - source: source.clone(), + source, mods: Some(imports), lib, } diff --git a/src/serde/metadata.rs b/src/serde/metadata.rs index 985e2dda..31e04aee 100644 --- a/src/serde/metadata.rs +++ b/src/serde/metadata.rs @@ -146,7 +146,11 @@ impl From<&crate::module::FuncInfo> for FnMetadata { } #[cfg(not(feature = "no_function"))] { - info.func.get_fn_def().comments.to_vec() + info.func + .get_script_fn_def() + .expect("never fails because the function is scripted") + .comments + .to_vec() } } else { Default::default()