Commit 0033f24b authored by Daniel Kochmański's avatar Daniel Kochmański

constant folding: fix regression for single and multiple values

Closes #497.
parent 5dd41742
......@@ -157,9 +157,15 @@
(push v all-values)
(return nil))
finally
(return (c1expr `(values ,@(multiple-value-list
(apply fname (nreverse all-values)))))))
(error (c)))))
(let ((results (multiple-value-list (apply fname (nreverse all-values)))))
(if (endp (rest results))
(c1constant-value (first results) :only-small-values nil)
(let ((results (mapcar (lambda (r)
(c1constant-value r :only-small-values nil))
results)))
(when (every #'identity results)
(make-c1form* 'values :args results))))))
(error (c) (cmpdebug "Can't constant-fold ~s ~s: ~a~%" fname forms c)))))
(defun c2expr (form)
(with-c1form-env (form form)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment