826 - augment name bindings when extending a function

This becomes important as we get closer to a repl for mu.
This commit is contained in:
Kartik K. Agaram 2015-02-23 00:22:45 -08:00
parent 4f359718d2
commit 7cd72da17c
1 changed files with 4 additions and 3 deletions

7
mu.arc
View File

@ -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)