Rename error variants
This commit is contained in:
@@ -38,6 +38,36 @@ macro_rules! compile {
|
||||
}};
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_function_declaration_with_spillover_params() -> anyhow::Result<()> {
|
||||
let compiled = compile!(debug r#"
|
||||
// we need more than 4 params to 'spill' into a stack var
|
||||
fn doSomething(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {};
|
||||
"#);
|
||||
|
||||
assert_eq!(
|
||||
compiled,
|
||||
indoc! {"
|
||||
j main
|
||||
doSomething:
|
||||
pop r8 #arg9
|
||||
pop r9 #arg8
|
||||
pop r10 #arg7
|
||||
pop r11 #arg6
|
||||
pop r12 #arg5
|
||||
pop r13 #arg4
|
||||
pop r14 #arg3
|
||||
pop r15 #arg2
|
||||
push ra
|
||||
pop ra
|
||||
sub sp 1
|
||||
j ra
|
||||
"}
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_function_declaration_with_register_params() -> anyhow::Result<()> {
|
||||
let compiled = compile!(debug r#"
|
||||
@@ -51,13 +81,9 @@ fn test_function_declaration_with_register_params() -> anyhow::Result<()> {
|
||||
indoc! {"
|
||||
j main
|
||||
doSomething:
|
||||
pop r8 #arg2
|
||||
pop r9 #arg1
|
||||
push ra
|
||||
push r4
|
||||
move r4 r0 #arg1
|
||||
push r5
|
||||
move r5 r1 #arg2
|
||||
pop r5
|
||||
pop r4
|
||||
pop ra
|
||||
j ra
|
||||
"}
|
||||
|
||||
Reference in New Issue
Block a user