about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-23 00:22:45 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-23 00:22:45 -0800
commit7cd72da17c979d3b5f8662f5e5d7e10796f1c8e4 (patch)
treed3bf403a574d62dd11246effd9d0ab9f94979e22
parent4f359718d2db69a5c6870e5c205c8676995c42b5 (diff)
downloadmu-7cd72da17c979d3b5f8662f5e5d7e10796f1c8e4.tar.gz
826 - augment name bindings when extending a function
This becomes important as we get closer to a repl for mu.
-rw-r--r--mu.arc7
1 files changed, 4 insertions, 3 deletions
diff --git a/mu.arc b/mu.arc
index 101f85bf..d5b15de3 100644
--- a/mu.arc
+++ b/mu.arc
@@ -1300,11 +1300,11 @@
 ;?   (tr "save names for function @name: @(tostring:pr location*.name)") ;? 1
   (replace-names-with-location instrs name))
 
-(def assign-names-to-location (instrs name)
+(def assign-names-to-location (instrs name (o init-locations))
   (trace "cn0" "convert-names in @name")
 ;?   (prn name ": " location*) ;? 1
   (point return
-  (ret location (table)
+  (ret location (or init-locations (table))
     ; if default-space in first instruction has a name, begin with its bindings
     (when (acons instrs.0)  ; not a label
       (let first-oarg-of-first-instr instrs.0.0  ; hack: assumes the standard default-space boilerplate
@@ -1599,7 +1599,8 @@
   (= function*.fn-name (convert-labels:convert-braces:tokenize-args:insert-code function*.fn-name fn-name))
   (check-default-space function*.fn-name fn-name)
   (add-next-space-generator function*.fn-name fn-name)
-  (convert-names function*.fn-name fn-name))
+  (= location*.fn-name (assign-names-to-location function*.fn-name fn-name location*.fn-name))
+  (replace-names-with-location function*.fn-name fn-name))
 
 (def tokenize-arg (arg)
 ;?   (tr "tokenize-arg " arg)