about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-09 20:50:19 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-09 20:50:19 -0700
commit0aed24e222f3dc7eb29b676ba9576f77dbc6b44d (patch)
tree475eb8f949571e8f3b758ce2d468184cf90e3885
parent6169ec59c00981cf8609f0cf2a153c502ca7d64f (diff)
downloadmu-0aed24e222f3dc7eb29b676ba9576f77dbc6b44d.tar.gz
.
-rw-r--r--shell/evaluate.mu2
-rw-r--r--shell/global.mu4
2 files changed, 3 insertions, 3 deletions
diff --git a/shell/evaluate.mu b/shell/evaluate.mu
index e4034f95..c8ca02a9 100644
--- a/shell/evaluate.mu
+++ b/shell/evaluate.mu
@@ -262,7 +262,7 @@ fn evaluate _in-ah: (addr handle cell), _out-ah: (addr handle cell), env-h: (han
     stream-to-array first-arg-data, tmp-ah
     var first-arg-data-string/eax: (addr array byte) <- lookup *tmp-ah
     var out-ah/edi: (addr handle cell) <- copy _out-ah
-    assign-or-create-global globals, first-arg-data-string, *out-ah, trace
+    var defined-index/eax: int <- assign-or-create-global globals, first-arg-data-string, *out-ah, trace
     trace-higher trace
     return
   }
diff --git a/shell/global.mu b/shell/global.mu
index 8eb4552d..275bb7c0 100644
--- a/shell/global.mu
+++ b/shell/global.mu
@@ -327,13 +327,12 @@ fn refresh-definition _self: (addr global-table), _index: int {
   stream-to-array correct-definition-name, curr-global-name-ah
 }
 
-fn assign-or-create-global _self: (addr global-table), name: (addr array byte), value: (handle cell), trace: (addr trace) {
+fn assign-or-create-global _self: (addr global-table), name: (addr array byte), value: (handle cell), trace: (addr trace) -> _/eax: int {
   var self/esi: (addr global-table) <- copy _self
   compare self, 0
   {
     break-if-!=
     abort "assign global"
-    return
   }
   var curr-index/ecx: int <- find-symbol-name-in-globals self, name
   {
@@ -353,6 +352,7 @@ fn assign-or-create-global _self: (addr global-table), name: (addr array byte),
   copy-array-object name, curr-name-ah
   var curr-value-ah/eax: (addr handle cell) <- get curr, value
   copy-handle value, curr-value-ah
+  return curr-index
 }
 
 fn lookup-symbol-in-globals _sym: (addr cell), out: (addr handle cell), _globals: (addr global-table), trace: (addr trace), screen-cell: (addr handle cell), keyboard-cell: (addr handle cell) {