Use actual outer scope for function-bang calls.

This commit is contained in:
Stephen Chung
2021-11-14 22:48:57 +08:00
parent dc918447b6
commit 615c3acad6
7 changed files with 67 additions and 19 deletions

View File

@@ -164,5 +164,22 @@ fn test_functions_bang() -> Result<(), Box<EvalAltResult>> {
165
);
assert_eq!(
engine.eval::<INT>(
"
fn foo() {
hello = 0;
hello + bar
}
let hello = 42;
let bar = 123;
foo!()
",
)?,
123
);
Ok(())
}