about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-09-26 23:50:05 -0700
committerKartik Agaram <vc@akkartik.com>2020-09-26 23:50:05 -0700
commitfec64dbc765339e8962767381ef144c07ba7050b (patch)
treecc2a93b7e09468a1ada0f72260705a52d6d06afe /apps
parent6e0ff0e5dceaa66e8883c336045713a74e845bb1 (diff)
downloadmu-fec64dbc765339e8962767381ef144c07ba7050b.tar.gz
6881 - tile: function calls can now be expanded
Diffstat (limited to 'apps')
-rw-r--r--apps/tile/environment.mu27
1 files changed, 20 insertions, 7 deletions
diff --git a/apps/tile/environment.mu b/apps/tile/environment.mu
index c343c106..2fba132b 100644
--- a/apps/tile/environment.mu
+++ b/apps/tile/environment.mu
@@ -253,21 +253,34 @@ fn render-line screen: (addr screen), defs: (addr handle function), bindings: (a
       }
       move-cursor screen, top-row, curr-col
       print-word screen, curr-word
-      var word-len/eax: int <- word-length curr-word
-      curr-col <- add word-len
-      curr-col <- add 2
-      add-to top-row, 1
+      {
+        var word-len/eax: int <- word-length curr-word
+        curr-col <- add word-len
+        curr-col <- add 2
+        add-to top-row, 1
+      }
+      # obtain stack at call site
+      var stack-storage: value-stack
+      var stack/edx: (addr value-stack) <- address stack-storage
+      initialize-value-stack stack, 0x10
+      {
+        var prev-word-ah/eax: (addr handle word) <- get curr-word, prev
+        var prev-word/eax: (addr word) <- lookup *prev-word-ah
+        compare prev-word, 0
+        break-if-=
+        evaluate defs, bindings, line, prev-word, stack
+      }
       # construct new bindings
       var callee-bindings-storage: table
       var callee-bindings/esi: (addr table) <- address callee-bindings-storage
       initialize-table callee-bindings, 0x10
-      # HERE: obtain stack at call site
-#?       bind-args callee, callee-bindings
+      bind-args callee, stack, callee-bindings
       # obtain body
       var callee-body-ah/eax: (addr handle line) <- get callee, body
       var callee-body/eax: (addr line) <- lookup *callee-body-ah
-      #
+      # - render subsidiary stack
       curr-col <- render-line screen, defs, callee-bindings, callee-body, top-row, curr-col, cursor-word, cursor-col-a
+      #
       curr-col <- add 2
       move-cursor screen, top-row, curr-col
       print-code-point screen, 0x21d7  # ⇗