Fix closure property access.

This commit is contained in:
Stephen Chung
2020-12-27 11:50:24 +08:00
parent 88f63fa24b
commit 48af8719e7
2 changed files with 17 additions and 10 deletions

View File

@@ -54,6 +54,17 @@ fn test_closures() -> Result<(), Box<EvalAltResult>> {
ParseErrorType::BadInput(_)
));
assert_eq!(
engine.eval::<INT>(
r"
let foo = #{ x: 42 };
let f = || { this.x };
foo.call(f)
",
)?,
42
);
assert_eq!(
engine.eval::<INT>(
r#"