diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-03-07 11:05:03 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-03-07 11:05:03 -0800 |
commit | d2b7e3f44ffdd0989f381722b503deb034e6c950 (patch) | |
tree | 6d8c3afec14b854ba8184161ca76061ac00795b3 /shell/print.mu | |
parent | 5b50feaeee6e754b451a45f1a914cb1eaa733a5f (diff) | |
download | mu-d2b7e3f44ffdd0989f381722b503deb034e6c950.tar.gz |
7863 - shell: anonymous fn calls
Diffstat (limited to 'shell/print.mu')
-rw-r--r-- | shell/print.mu | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/shell/print.mu b/shell/print.mu index 46782705..22c00543 100644 --- a/shell/print.mu +++ b/shell/print.mu @@ -79,16 +79,6 @@ fn print-list _in: (addr cell), out: (addr stream byte), trace: (addr trace) { write out, "(" $print-list:loop: { var left/ecx: (addr handle cell) <- get curr, left - { - var left-addr/eax: (addr cell) <- lookup *left - var left-is-nil?/eax: boolean <- is-nil? left-addr - compare left-is-nil?, 0/false - { - break-if-= - trace-text trace, "print", "left is null" - break $print-list:loop - } - } print-cell left, out, trace var right/ecx: (addr handle cell) <- get curr, right var right-addr/eax: (addr cell) <- lookup *right @@ -251,6 +241,27 @@ fn test-print-cell-list { check-stream-equal out, "(64 abc)", "F - test-print-cell-list" } +fn test-print-cell-list-of-nil { + # list = cons "abc", nil + var left-storage: (handle cell) + var left/ecx: (addr handle cell) <- address left-storage + allocate-pair left + var nil-storage: (handle cell) + var nil/edx: (addr handle cell) <- address nil-storage + allocate-pair nil + var list-storage: (handle cell) + var list/esi: (addr handle cell) <- address list-storage + new-pair list, *left, *nil + # list = cons 64, list + new-integer left, 0x40 + new-pair list, *left, *list + # + var out-storage: (stream byte 0x40) + var out/edi: (addr stream byte) <- address out-storage + print-cell list, out, 0/no-trace + check-stream-equal out, "(64 ())", "F - test-print-cell-list-nil" +} + fn test-print-dotted-list { # list = cons 64, "abc" var left-storage: (handle cell) |