mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-14 05:12:38 -08:00
The compiler checks whether the forms it parses are properlist.
This commit is contained in:
parent
02e796e425
commit
cfbf245ec7
1 changed files with 15 additions and 2 deletions
|
|
@ -218,8 +218,21 @@
|
|||
(print-compiler-message c t)
|
||||
(abort)))
|
||||
|
||||
(defun check-args-number (operator args &optional (min 0) (max nil))
|
||||
(let ((l (length args)))
|
||||
(defun safe-list-length (l)
|
||||
(cond ((null l)
|
||||
0)
|
||||
((atom l)
|
||||
nil)
|
||||
(t
|
||||
(handler-case (list-length l)
|
||||
(error (c) nil)))))
|
||||
|
||||
(defun check-args-number (operator args &optional (min 0) (max most-positive-fixnum))
|
||||
|
||||
(let ((l (safe-list-length args)))
|
||||
(when (null l)
|
||||
(let ((*print-circle* t))
|
||||
(cmperr "Improper or circular list passed to ~A~%~A" operator args)))
|
||||
(when (< l min)
|
||||
(too-few-args operator min l))
|
||||
(when (and max (> l max))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue