mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-27 06:51:44 -08:00
cmp: fix inlining of functions with &key and &aux arguments
&aux arguments come after &key ones. Fixes #633.
This commit is contained in:
parent
83ed2e1722
commit
977e2fab34
2 changed files with 26 additions and 2 deletions
|
|
@ -640,8 +640,6 @@ The function thus belongs to the type of functions that ecl_make_cfun accepts."
|
|||
`(list ,@arguments))
|
||||
(if apply-p apply-var nil)))
|
||||
let-vars))
|
||||
(loop while aux-vars
|
||||
do (push (list (pop aux-vars) (pop aux-vars)) let-vars))
|
||||
(do ((scan (cdr keywords) (cddddr scan)))
|
||||
((endp scan))
|
||||
(let ((keyword (first scan))
|
||||
|
|
@ -660,6 +658,8 @@ The function thus belongs to the type of functions that ecl_make_cfun accepts."
|
|||
let-vars))))
|
||||
(when (and key-flag (not allow-other-keys))
|
||||
(push `(si::check-keyword ,rest ',all-keys) extra-stmts))
|
||||
(loop while aux-vars
|
||||
do (push (list (pop aux-vars) (pop aux-vars)) let-vars))
|
||||
(values (nreverse (delete-if-not #'first let-vars))
|
||||
`(,@(and apply-var `((declare (ignorable ,apply-var))))
|
||||
,@(multiple-value-bind (decl body)
|
||||
|
|
|
|||
|
|
@ -2013,3 +2013,27 @@
|
|||
(multiple-value-list
|
||||
(funcall
|
||||
(compile nil '(lambda () (values (values)))))))))
|
||||
|
||||
;;; Date 2021-03-25
|
||||
;;; URL: https://gitlab.com/embeddable-common-lisp/ecl/-/issues/633
|
||||
;;; Description
|
||||
;;;
|
||||
;;; The order of function arguments was wrong when inlining a
|
||||
;;; function with &key and &aux arguments. This test checks
|
||||
;;; correct ordering in general.
|
||||
(test cmp.0086.inline-ordering-function-arguments
|
||||
(is (equal (multiple-value-list
|
||||
(funcall (compile nil '(lambda ()
|
||||
(flet ((f (a
|
||||
&optional (b a)
|
||||
&rest c
|
||||
&key (d c)
|
||||
&aux (e d))
|
||||
(list a b c d e)))
|
||||
(declare (inline f))
|
||||
(values (f 1)
|
||||
(f 1 2)
|
||||
(f 1 2 :d 3)))))))
|
||||
'((1 1 nil nil nil)
|
||||
(1 2 nil nil nil)
|
||||
(1 2 (:d 3) 3 3)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue