about summary refs log tree commit diff stats
path: root/shell/macroexpand.mu
diff options
context:
space:
mode:
Diffstat (limited to 'shell/macroexpand.mu')
-rw-r--r--shell/macroexpand.mu23
1 files changed, 7 insertions, 16 deletions
diff --git a/shell/macroexpand.mu b/shell/macroexpand.mu
index 047d4dfd..2f1cb5de 100644
--- a/shell/macroexpand.mu
+++ b/shell/macroexpand.mu
@@ -1,20 +1,11 @@
-fn macroexpand _in-ah: (addr handle cell), _out-ah: (addr handle cell), globals: (addr global-table), trace: (addr trace) {
-  var in-ah/esi: (addr handle cell) <- copy _in-ah
-  var out-ah/edi: (addr handle cell) <- copy _out-ah
+fn macroexpand expr-ah: (addr handle cell), globals: (addr global-table), trace: (addr trace) {
   # loop until convergence
-  {
-    macroexpand-iter in-ah, out-ah, globals, trace
-    var _in/eax: (addr cell) <- lookup *in-ah
-    var in/ecx: (addr cell) <- copy _in
-    var out/eax: (addr cell) <- lookup *out-ah
-    var done?/eax: boolean <- cell-isomorphic? in, out, trace
-    compare done?, 0/false
-    break-if-!=
-    copy-object out-ah, in-ah
-    loop
-  }
+  var expanded?/eax: boolean <- macroexpand-iter expr-ah, globals, trace
+  compare expanded?, 0/false
+  loop-if-!=
 }
 
-fn macroexpand-iter _in-ah: (addr handle cell), _out-ah: (addr handle cell), globals: (addr global-table), trace: (addr trace) {
-  copy-object _in-ah, _out-ah
+# return true if we found any macros
+fn macroexpand-iter _expr-ah: (addr handle cell), globals: (addr global-table), trace: (addr trace) -> _/eax: boolean {
+  return 0/false
 }