feat(tazjin/rlox): Support local variables

WIP

Change-Id: I78fbc885faaac165c380cbd9aa98b4b64a9b8274
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3685
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Vincent Ambo 2021-10-03 14:20:44 +03:00 committed by tazjin
parent ad7e591c80
commit c318f42c11
6 changed files with 193 additions and 12 deletions

View file

@ -128,6 +128,23 @@ fn global_assignment() {
breakfast = "beignets with " + beverage;
breakfast;
"#,
"beignets with cafe au lait"
"beignets with cafe au lait",
);
}
#[test]
fn local_variables() {
expect_num(
r#"
var a = 10;
var b = 5;
{
var b = 10;
var c = 2;
a * b * c;
}
"#,
200.0,
);
}