Function: byte-compile-check-lambda-list
byte-compile-check-lambda-list is a byte-compiled function defined in
bytecomp.el.gz.
Signature
(byte-compile-check-lambda-list LIST)
Documentation
Check lambda-list LIST for errors.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-check-lambda-list (list)
"Check lambda-list LIST for errors."
(let (vars)
(while list
(let ((arg (car list)))
(cond ((or (not (symbolp arg))
(macroexp--const-symbol-p arg t))
(error "Invalid lambda variable %s" arg))
((eq arg '&rest)
(unless (cdr list)
(error "&rest without variable name"))
(when (cddr list)
(error "Garbage following &rest VAR in lambda-list"))
(when (memq (cadr list) '(&optional &rest))
(error "%s following &rest in lambda-list" (cadr list))))
((eq arg '&optional)
(when (memq '&optional (cdr list))
(error "Duplicate &optional")))
((and (memq arg vars)
;; Allow repetitions for unused args.
(not (string-match "\\`_" (symbol-name arg))))
(byte-compile-warn-x
arg "repeated variable %s in lambda-list" arg))
(t
(push arg vars))))
(setq list (cdr list)))))