1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-30 00:40:20 +02:00

fix alpha-rename for kwargs

* module/language/tree-il/optimize.scm (alpha-rename): Fix
  alpha-renaming of keyword arguments.
This commit is contained in:
Andy Wingo 2011-09-22 17:43:36 +02:00
parent a4c7fe5cde
commit c829531a46

View file

@ -65,9 +65,19 @@ references to the new symbols."
(append req (append req
(or opt '()) (or opt '())
(if rest (list rest) '()) (if rest (list rest) '())
(if kw (map cadr (cdr kw)) '())))) (match kw
((aok? (_ name _) ...) name)
(_ '())))))
(mapping (fold vhash-consq mapping gensyms new))) (mapping (fold vhash-consq mapping gensyms new)))
(make-lambda-case src req opt rest kw inits new (make-lambda-case src req opt rest
(match kw
((aok? (kw name old) ...)
(cons aok? (map list
kw
name
(take-right new (length old)))))
(_ #f))
inits new
(loop body mapping) (loop body mapping)
(and alt (loop alt mapping))))) (and alt (loop alt mapping)))))
(($ <lexical-ref> src name gensym) (($ <lexical-ref> src name gensym)