Allow module access in closures.

This commit is contained in:
Stephen Chung
2020-08-22 22:44:24 +08:00
parent 0b04d05afe
commit 0ece75aba3
4 changed files with 32 additions and 2 deletions

View File

@@ -120,6 +120,20 @@ fn test_fn_ptr_raw() -> Result<(), Box<EvalAltResult>> {
42
);
assert_eq!(
engine.eval::<INT>(
r#"
fn foo(x, y) { this += x + y; }
let x = 40;
let v = 1;
x.bar(Fn("foo").curry(v), 1);
x
"#
)?,
42
);
assert!(matches!(
*engine.eval::<INT>(
r#"