Skip to content

Commit a41f30e

Browse files
committed
chore(tests): test tail calls to ensure arguments are correct when swapping them around between calls
1 parent be36226 commit a41f30e

File tree

4 files changed

+128
-81
lines changed

4 files changed

+128
-81
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(let f (fun (a b)
2+
(if (nil? b)
3+
(f "wrong" a)
4+
(print b))))
5+
6+
(f "correct" nil)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
page_0
2+
LOAD_CONST 0
3+
STORE 0
4+
PUSH_RETURN_ADDRESS L3
5+
BUILTIN 2
6+
LOAD_CONST 2
7+
LOAD_FAST_BY_INDEX 0
8+
CALL 2
9+
.L3:
10+
HALT 0
11+
12+
page_1
13+
STORE 1
14+
STORE 2
15+
LOAD_FAST_BY_INDEX 0
16+
IS_NIL 0
17+
POP_JUMP_IF_TRUE L0
18+
PUSH_RETURN_ADDRESS L1
19+
LOAD_FAST_BY_INDEX 0
20+
BUILTIN 9
21+
CALL 1
22+
.L1:
23+
JUMP L2
24+
.L0:
25+
LOAD_SYMBOL 1
26+
LOAD_CONST 1
27+
JUMP 0
28+
.L2:
29+
RET 0
30+
HALT 0

0 commit comments

Comments
 (0)