Add function name to NativeCallContext.

This commit is contained in:
Stephen Chung
2021-01-21 21:49:25 +08:00
parent f6553c1426
commit 8aae3ac46c
5 changed files with 50 additions and 29 deletions

View File

@@ -1971,12 +1971,16 @@ impl Engine {
let args = &mut [lhs_ptr_inner, &mut rhs_val];
// Overriding exact implementation
let source = source.or_else(|| state.source.as_ref());
let source =
source.or_else(|| state.source.as_ref()).map(|s| s.as_str());
if func.is_plugin_fn() {
func.get_plugin_fn()
.call((self, source, &*mods, lib).into(), args)?;
.call((self, op.as_ref(), source, &*mods, lib).into(), args)?;
} else {
func.get_native_fn()((self, source, &*mods, lib).into(), args)?;
func.get_native_fn()(
(self, op.as_ref(), source, &*mods, lib).into(),
args,
)?;
}
}
// Built-in op-assignment function