mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-25 13:05:05 +02:00
Added a simplistic form of renaming
This commit is contained in:
parent
0578c4963a
commit
ee8b5eeb65
1 changed files with 24 additions and 24 deletions
|
@ -266,31 +266,31 @@
|
||||||
((lambda (renames)
|
((lambda (renames)
|
||||||
(lambda (identifier)
|
(lambda (identifier)
|
||||||
((lambda (cell)
|
((lambda (cell)
|
||||||
; (if cell
|
(if cell
|
||||||
; (cdr cell)
|
(cdr cell)
|
||||||
; ((lambda (name)
|
((lambda (name)
|
||||||
; (set! renames (cons (cons identifier name) renames))
|
(set! renames (cons (cons identifier name) renames))
|
||||||
; name)
|
name)
|
||||||
|
|
||||||
; (let ((val (env:lookup identifier mac-env 'not-defined)))
|
(let ((val (env:lookup identifier mac-env 'not-defined)))
|
||||||
; (cond
|
(cond
|
||||||
; ((eq? val 'not-defined)
|
((or (not (tagged-list? 'macro val)) ;; TODO: For now only rename macros, but should support anything
|
||||||
; identifier)
|
(eq? val 'not-defined))
|
||||||
; (else
|
|
||||||
; (let ((renamed (gensym identifier)))
|
|
||||||
; (env:define-variable! renamed val mac-env)
|
|
||||||
; renamed))))
|
|
||||||
; ;
|
|
||||||
; ;(gensym identifier)
|
|
||||||
; ; gensym not good enough, need to also preserve ref trans.
|
|
||||||
; ; also note that an identifier can be an object, it does not
|
|
||||||
; ; just have to be a symbol. although, of course, the rest
|
|
||||||
; ; of the code needs to be able to handle identifiers in
|
|
||||||
; ; forms other than symbols, if that is done.
|
|
||||||
; ;
|
|
||||||
; ;(make-syntactic-closure mac-env '() identifier)
|
|
||||||
; )))
|
|
||||||
identifier)
|
identifier)
|
||||||
|
(else
|
||||||
|
(let ((renamed (gensym identifier)))
|
||||||
|
(env:define-variable! renamed val mac-env)
|
||||||
|
renamed))))
|
||||||
|
;
|
||||||
|
;(gensym identifier)
|
||||||
|
; gensym not good enough, need to also preserve ref trans.
|
||||||
|
; also note that an identifier can be an object, it does not
|
||||||
|
; just have to be a symbol. although, of course, the rest
|
||||||
|
; of the code needs to be able to handle identifiers in
|
||||||
|
; forms other than symbols, if that is done.
|
||||||
|
;
|
||||||
|
;(make-syntactic-closure mac-env '() identifier)
|
||||||
|
)))
|
||||||
(assq identifier renames))
|
(assq identifier renames))
|
||||||
))
|
))
|
||||||
;; TODO: For now, do not allow renaming of special form symbols to
|
;; TODO: For now, do not allow renaming of special form symbols to
|
||||||
|
|
Loading…
Add table
Reference in a new issue