mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-14 21:32:49 -08:00
Fixed the compiler for MULTIPLE-VALUE-BIND, which was producing wrong code because it set bindings _before_ the values form.
This commit is contained in:
parent
c644e6e761
commit
35bceed7d8
1 changed files with 20 additions and 5 deletions
|
|
@ -128,8 +128,23 @@
|
|||
(*cmp-env* (cmp-env-copy)))
|
||||
(check-args-number 'MULTIPLE-VALUE-BIND args 2)
|
||||
(let* ((variables (pop args))
|
||||
(values (pop args)))
|
||||
(c1translate destination
|
||||
`(let ,variables
|
||||
(multiple-value-setq ,variables ,values)
|
||||
(locally ,@args)))))
|
||||
(values (pop args))
|
||||
(body args))
|
||||
(c1translate
|
||||
destination
|
||||
(case (length variables)
|
||||
;; Simple cases can be rewritten as more efficient forms
|
||||
;; Note that without variables we need a body because otherwise
|
||||
;; the VALUES form is output.
|
||||
(0 `(progn ,values ,@(or body '((progn)))))
|
||||
(1 `(let ((,(first variables) ,values)) ,@body))
|
||||
;; FIXME! This is ugly ugly and it is there because we do not want
|
||||
;; to duplicate the code in LET/LET* but surely there is a better
|
||||
;; way.
|
||||
(t (let ((temps (loop for i in variables collect (gensym "VALUES"))))
|
||||
`(let ,temps
|
||||
(multiple-value-setq ,temps ,values)
|
||||
(let (,@(loop for a in variables
|
||||
for b in temps
|
||||
collect (list a b)))
|
||||
,@body))))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue