about summary refs log tree commit diff stats
path: root/apps/mu.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-27 00:17:51 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-27 00:17:51 -0800
commit530af63477e5264a312facf4a17b32cf79dbbd96 (patch)
treeeb6dac0912b7288fd4dce50cfcec367632d71fcf /apps/mu.subx
parent125bfde435b4727cbc8d31bc86f47dc75b825d5e (diff)
downloadmu-530af63477e5264a312facf4a17b32cf79dbbd96.tar.gz
7287
Regression: I'd broken compare on bytes. Apparently I took away support
for bytes from numberlike-output even though I didn't need to by the end.
Diffstat (limited to 'apps/mu.subx')
-rw-r--r--apps/mu.subx34
1 files changed, 34 insertions, 0 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index 91825443..55cf7c57 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -3821,6 +3821,35 @@ test-convert-compare-register-with-literal:
     5d/pop-to-ebp
     c3/return
 
+test-convert-compare-byte-with-literal:
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # setup
+    (clear-stream _test-input-stream)
+    (clear-stream $_test-input-buffered-file->buffer)
+    (clear-stream _test-output-stream)
+    (clear-stream $_test-output-buffered-file->buffer)
+    #
+    (write _test-input-stream "fn foo {\n")
+    (write _test-input-stream "  var x/ecx: byte <- copy 0\n")
+    (write _test-input-stream "  compare x, 0\n")
+    (write _test-input-stream "}\n")
+    # convert
+    (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0)
+    (flush _test-output-buffered-file)
+#?     # dump _test-output-stream {{{
+#?     (write 2 "^")
+#?     (write-stream 2 _test-output-stream)
+#?     (write 2 "$\n")
+#?     (rewind-stream _test-output-stream)
+#?     # }}}
+    # no errors; output is identical to test-convert-compare-register-with-literal
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
 test-unknown-variable:
     # . prologue
     55/push-ebp
@@ -21737,6 +21766,11 @@ $is-mu-numberlike-output?:check-boolean:
     (is-simple-mu-type? %esi 5)  # boolean => eax
     3d/compare-eax-and 0/imm32/false
     75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8
+$is-mu-numberlike-output?:check-byte:
+    # if t is a byte, return
+    (is-simple-mu-type? %esi 8)  # byte => eax
+    3d/compare-eax-and 0/imm32/false
+    75/jump-if-!= $is-mu-numberlike-output?:return-true/disp8
 $is-mu-numberlike-output?:check-code-point:
     # if t is a code-point, return
     (is-simple-mu-type? %esi 0xd)  # code-point => eax