about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-03 17:08:40 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-18 00:44:48 -0700
commit2456d89f8ad797e123b2ba877bf1de8675beb4b4 (patch)
tree85467598a0888cc2d9aa729a81bdddaa1b1627c2
parentb9cfa360007c2952d6cde3fe7d6bec6b505bbfb8 (diff)
downloadmu-2456d89f8ad797e123b2ba877bf1de8675beb4b4.tar.gz
mu.subx: parse-mu-var-def tests
Still no passing tests; we're just manually translating.
-rw-r--r--apps/mu.subx14
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index e0d5b8a6..78ba6027 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -5149,6 +5149,10 @@ test-parse-mu-var-def:
     # setup
     (clear-stream _test-input-stream)
     (write _test-input-stream "n: int\n")  # caller has consumed the 'var'
+    # var out/eax: (handle stmt)
+    68/push 0/imm32
+    68/push 0/imm32
+    89/<- %eax 4/r32/esp
     # var vars/ecx: (stack (addr var) 16)
     81 5/subop/subtract %esp 0x80/imm32
     68/push 0x80/imm32/size
@@ -5156,7 +5160,8 @@ test-parse-mu-var-def:
     89/<- %ecx 4/r32/esp
     (clear-stack %ecx)
     # convert
-    (parse-mu-var-def _test-input-stream %ecx)  # => eax
+    (parse-mu-var-def _test-input-stream %ecx %eax)
+    (lookup *eax *(eax+4))  # => eax
     # check result
     (check-ints-equal *eax 2 "F - test-parse-mu-var-def/tag")  # Stmt-tag is var-def
     8b/-> *(eax+4) 0/r32/eax  # Vardef-var
@@ -5180,6 +5185,10 @@ test-parse-mu-reg-var-def:
     # setup
     (clear-stream _test-input-stream)
     (write _test-input-stream "n/eax: int <- copy 0\n")  # caller has consumed the 'var'
+    # var out/eax: (handle stmt)
+    68/push 0/imm32
+    68/push 0/imm32
+    89/<- %eax 4/r32/esp
     # var vars/ecx: (stack (addr var) 16)
     81 5/subop/subtract %esp 0x80/imm32
     68/push 0x80/imm32/size
@@ -5187,7 +5196,8 @@ test-parse-mu-reg-var-def:
     89/<- %ecx 4/r32/esp
     (clear-stack %ecx)
     # convert
-    (parse-mu-var-def _test-input-stream %ecx)  # => eax
+    (parse-mu-var-def _test-input-stream %ecx %eax)
+    (lookup *eax *(eax+4))  # => eax
     # check result
     (check-ints-equal *eax 3 "F - test-parse-mu-reg-var-def/tag")  # Stmt-tag is reg-var-def
     8b/-> *(eax+0xc) 0/r32/eax  # Regvardef-outputs