Engine::register_global_module and Engine::register_static_module must be passed shared Module.

This commit is contained in:
Stephen Chung
2020-12-23 10:08:43 +08:00
parent 15fb03218c
commit f55a56c6bc
11 changed files with 23 additions and 22 deletions

View File

@@ -37,7 +37,7 @@ fn test_packages_with_script() -> Result<(), Box<EvalAltResult>> {
let ast = engine.compile("fn foo(x) { x + 1 } fn bar(x) { foo(x) + 1 }")?;
let module = Module::eval_ast_as_new(Scope::new(), &ast, &engine)?;
engine.register_global_module(module);
engine.register_global_module(module.into());
assert_eq!(engine.eval::<INT>("foo(41)")?, 42);
assert_eq!(engine.eval::<INT>("bar(40)")?, 42);