A bunch of prerequisites before we can do arrays, part 3.1, using the pool pointer in calls (removes the cursed test case)

This commit is contained in:
2023-11-13 00:44:26 -06:00
parent 325288d7ba
commit 749b11adfa
3 changed files with 26 additions and 11 deletions
+20 -1
View File
@@ -86,7 +86,26 @@ fn scope_test() {
}
#[test]
fn cursed_call_test() {
fn recursion_test() {
// Recursive call with some stuff in it
assert_eq!(
main_return(
"fn sum(n) {
if (n > 0) {
return n + sum(n - 1);
} else {
return 0;
}
}
fn main() { return sum(5); }"),
15
)
}
//#[test]
// This is no longer cursed, or a test. The revised calling convention with the pool pointer makes
// it now perfectly sane. Left here for posterity.
fn _cursed_call_test() {
// This is a cursed subtlety of block scoping and the way calls are compiled. It's not actually
// a bug. It's explained below:
let src = "