Implement AST for 'const' expressions. TODO -- add const expressions to compiler

This commit is contained in:
2025-12-04 18:01:16 -07:00
parent e05f130040
commit 4b6c7eb63c
9 changed files with 123 additions and 19 deletions

View File

@@ -149,6 +149,7 @@ fn test_spilled_variable_update_in_branch() -> anyhow::Result<()> {
sub r0 sp 1
put db r0 99 #h
L1:
sub sp sp 1
"
}
);

View File

@@ -34,6 +34,8 @@ fn no_arguments() -> anyhow::Result<()> {
#[test]
fn let_var_args() -> anyhow::Result<()> {
// !IMPORTANT this needs to be stabilized as it currently incorrectly calculates sp offset at
// both ends of the cleanup lifecycle
let compiled = compile! {
debug
"
@@ -64,6 +66,7 @@ fn let_var_args() -> anyhow::Result<()> {
get r8 db r0
sub sp sp 1
move r9 r15 #i
sub sp sp 1
"
}
);
@@ -123,6 +126,7 @@ fn inline_literal_args() -> anyhow::Result<()> {
get r8 db r0
sub sp sp 1
move r9 r15 #returnedValue
sub sp sp 1
"
}
);
@@ -164,6 +168,7 @@ fn mixed_args() -> anyhow::Result<()> {
get r8 db r0
sub sp sp 1
move r9 r15 #returnValue
sub sp sp 1
"
}
);

View File

@@ -56,6 +56,7 @@ fn variable_declaration_numeric_literal_stack_spillover() -> anyhow::Result<()>
push 7 #h
push 8 #i
push 9 #j
sub sp sp 3
"
}
);