fix SetLocal not taking into account the stack bottom
y'know, when you look for locals relative to the call frame's bottom, but then set locals relative to index 0... boom. closes #78
This commit is contained in:
parent
f4ceb0057e
commit
39989e555a
2 changed files with 17 additions and 1 deletions
|
@ -266,3 +266,18 @@ fn system_arithmetic() {
|
|||
expect_number("1 + 2 + 3 + 4", 10.0, 0.0001);
|
||||
expect_number("(2 * 1) + 1 + (6 / 2) + (10 - 3)", 13.0, 0.0001);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_78() {
|
||||
let code = r#"
|
||||
f = \_ ->
|
||||
let x = 1
|
||||
x + x
|
||||
|
||||
[
|
||||
f ()
|
||||
f ()
|
||||
]
|
||||
"#;
|
||||
assert_eq!(eval(code).unwrap(), Value::Ref(RefId::from_u32(2)))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue