A prototype of a new feature to automatically curry of external scope variables

This commit is contained in:
Ilya Lakhin
2020-07-26 09:18:18 +07:00
parent e2daba55d7
commit 8e51988b66
3 changed files with 132 additions and 25 deletions

View File

@@ -209,3 +209,24 @@ fn test_fn_ptr_curry_call() -> Result<(), Box<EvalAltResult>> {
Ok(())
}
#[test]
fn test_fn_closures() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
let res = engine.eval::<INT>(
r#"
let x = 100;
let f = || x;
let x = 200;
f.call()
"#
).unwrap();
panic!("{:#?}", res);
Ok(())
}