Fix AST combine.

This commit is contained in:
Stephen Chung
2022-05-21 11:31:15 +08:00
parent 46c1d86221
commit 9c1a49da0b
2 changed files with 34 additions and 0 deletions

View File

@@ -282,6 +282,19 @@ fn test_module_resolver() -> Result<(), Box<EvalAltResult>> {
let result: INT = engine.call_fn(&mut Scope::new(), &ast, "foo", (2 as INT,))?;
assert_eq!(result, 84);
let mut ast2 = engine.compile("fn foo(x) { 42 }")?;
let len = ast.resolver().unwrap().len();
ast2 += ast;
assert!(ast2.resolver().is_some());
assert_eq!(ast2.resolver().unwrap().len(), len);
let result: INT = engine.call_fn(&mut Scope::new(), &ast2, "foo", (2 as INT,))?;
assert_eq!(result, 84);
}
Ok(())