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

@@ -286,7 +286,8 @@ fn test_closures_external() -> Result<(), Box<EvalAltResult>> {
let lib = [ast.as_ref()];
// Create native call context
let context = NativeCallContext::new(&engine, &lib);
let fn_name = fn_ptr.fn_name().to_string();
let context = NativeCallContext::new(&engine, &fn_name, &lib);
// Closure 'f' captures: the engine, the AST, and the curried function pointer
let f = move |x: INT| fn_ptr.call_dynamic(context, None, [x.into()]);