X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fparse-lambda-list.lisp;h=affb94d95dd0bb0b4506bb89292f2b53dfc34bcf;hb=95591ed483dbb8c0846c129953acac1554f28809;hp=d98953b0fcf825eafcfdea505c526ca7bcd7211c;hpb=d604a358d8e5eb5587989e0a4f1d31dbe6ac5ffe;p=sbcl.git diff --git a/src/compiler/parse-lambda-list.lisp b/src/compiler/parse-lambda-list.lisp index d98953b..affb94d 100644 --- a/src/compiler/parse-lambda-list.lisp +++ b/src/compiler/parse-lambda-list.lisp @@ -34,7 +34,7 @@ ;;; arg specifiers are just passed through untouched. If something is ;;; wrong, we use COMPILER-ERROR, aborting compilation to the last ;;; recovery point. -(declaim (ftype (sfunction (list) +(declaim (ftype (sfunction (list &key (:silent boolean)) (values list list boolean t boolean list boolean boolean list boolean t t boolean)) parse-lambda-list-like-thing)) @@ -42,7 +42,7 @@ (values list list boolean t boolean list boolean boolean list boolean t t)) parse-lambda-list)) -(defun parse-lambda-list-like-thing (list) +(defun parse-lambda-list-like-thing (list &key silent) (collect ((required) (optional) (keys) @@ -86,8 +86,9 @@ (compiler-error "misplaced &KEY in lambda list: ~S" list)) #-sb-xc-host (when (optional) - (compiler-style-warn - "&OPTIONAL and &KEY found in the same lambda list: ~S" list)) + (unless silent + (compiler-style-warn + "&OPTIONAL and &KEY found in the same lambda list: ~S" list))) (setq keyp t state :key)) (&allow-other-keys @@ -104,14 +105,32 @@ (compiler-error "multiple &AUX in lambda list: ~S" list)) (setq auxp t state :aux)) - (t (bug "unknown LAMBDA-LIST-KEYWORD in lambda list: ~S." arg))) + (t + ;; It could be argued that &WHOLE and friends would be + ;; just ordinary variables in an ordinary lambda-list, + ;; but since (1) that seem exceedingly to have been the + ;; programmers intent and (2) the spec can be + ;; interpreted as giving as licence to signal an + ;; error[*] that is what we do. + ;; + ;; [* All lambda list keywords used in the + ;; implementation appear in LAMBDA-LIST-KEYWORDS. Each + ;; member of a lambda list is either a parameter + ;; specifier ot a lambda list keyword. Ergo, symbols + ;; appearing in LAMBDA-LIST-KEYWORDS cannot be + ;; parameter specifiers.] + (compiler-error 'simple-program-error + :format-control "Bad lambda list keyword ~S in: ~S" + :format-arguments (list arg list)))) (progn (when (symbolp arg) (let ((name (symbol-name arg))) (when (and (plusp (length name)) (char= (char name 0) #\&)) - (style-warn - "suspicious variable in lambda list: ~S." arg)))) + ;; Should this be COMPILER-STYLE-WARN? + (unless silent + (style-warn + "suspicious variable in lambda list: ~S." arg))))) (case state (:required (required arg)) (:optional (optional arg)) @@ -144,7 +163,6 @@ ;;; even if they could conceivably be legal in not-quite-a-lambda-list ;;; weirdosities (defun parse-lambda-list (lambda-list) - ;; Classify parameters without checking their validity individually. (multiple-value-bind (required optional restp rest keyp keys allowp auxp aux morep more-context more-count)