;;; used for both FUNCTION and VALUES types.
(declaim (ftype (function (list args-type) (values)) parse-args-types))
(defun parse-args-types (lambda-list result)
- (multiple-value-bind (required optional restp rest keyp keys allowp aux)
+ (multiple-value-bind (required optional restp rest keyp keys allowp auxp aux)
(parse-lambda-list-like-thing lambda-list)
- (when aux
+ (declare (ignore aux)) ; since we require AUXP=NIL
+ (when auxp
(error "&AUX in a FUNCTION or VALUES type: ~S." lambda-list))
(setf (args-type-required result) (mapcar #'specifier-type required))
(setf (args-type-optional result) (mapcar #'specifier-type optional))
;;; Break something like a lambda list (but not necessarily actually a
;;; lambda list, e.g. the representation of argument types which is
;;; used within an FTYPE specification) into its component parts. We
-;;; return eleven values:
+;;; return twelve values:
;;; 1. a list of the required args;
;;; 2. a list of the &OPTIONAL arg specs;
;;; 3. true if a &REST arg was specified;
;;; 5. true if &KEY args are present;
;;; 6. a list of the &KEY arg specs;
;;; 7. true if &ALLOW-OTHER-KEYS was specified.;
-;;; 8. a list of the &AUX specifiers;
-;;; 9. true if a &MORE arg was specified;
-;;; 10. the &MORE context var;
-;;; 11. the &MORE count var.
+;;; 8. true if any &AUX is present (new in SBCL vs. CMU CL);
+;;; 9. a list of the &AUX specifiers;
+;;; 10. true if a &MORE arg was specified;
+;;; 11. the &MORE context var;
+;;; 12. the &MORE count var.
;;;
;;; The top level lambda list syntax is checked for validity, but the
;;; arg specifiers are just passed through untouched. If something is
;;; recovery point.
(declaim (ftype (function (list)
(values list list boolean t boolean list boolean
- list boolean t t))
+ boolean list boolean t t))
parse-lambda-list-like-thing
parse-lambda-list))
(defun parse-lambda-list-like-thing (list)
(more-context nil)
(more-count nil)
(keyp nil)
+ (auxp nil)
(allowp nil)
(state :required))
(declare (type (member :allow-other-keys :aux
(&aux
(when (member state '(:rest :more-context :more-count))
(compiler-error "misplaced &AUX in lambda list: ~S" list))
- (setq state :aux))
+ (setq auxp t
+ state :aux))
;; FIXME: I don't think ANSI says this is an error. (It
;; should certainly be good for a STYLE-WARNING,
;; though.)
(when (eq state :rest)
(compiler-error "&REST without rest variable"))
- (values (required) (optional) restp rest keyp (keys) allowp (aux)
+ (values (required) (optional) restp rest keyp (keys) allowp auxp (aux)
morep more-context more-count))))
;;; like PARSE-LAMBDA-LIST-LIKE-THING, except our LAMBDA-LIST argument
(defun parse-lambda-list (lambda-list)
;; Classify parameters without checking their validity individually.
- (multiple-value-bind (required optional restp rest keyp keys allowp aux
+ (multiple-value-bind (required optional restp rest keyp keys allowp auxp aux
morep more-context more-count)
(parse-lambda-list-like-thing lambda-list)
i))))))
;; Voila.
- (values required optional restp rest keyp keys allowp aux
+ (values required optional restp rest keyp keys allowp auxp aux
morep more-context more-count)))
(/show0 "parse-lambda-list.lisp end of file")
(error
"invalid argument ~S in the generic function lambda list ~S"
arg lambda-list))))
- (multiple-value-bind (required optional restp rest keyp keys allowp aux
- morep more-context more-count)
+ (multiple-value-bind (required optional restp rest keyp keys allowp
+ auxp aux morep more-context more-count)
(parse-lambda-list lambda-list)
(declare (ignore required)) ; since they're no different in a gf ll
(declare (ignore restp rest)) ; since they're no different in a gf ll
(declare (ignore allowp)) ; since &ALLOW-OTHER-KEYS is fine either way
+ (declare (ignore aux)) ; since we require AUXP=NIL
(declare (ignore more-context more-count)) ; safely ignored unless MOREP
;; no defaults allowed for &OPTIONAL arguments
(dolist (i optional)
(null (cddar i))))
(null (cdr i)))))))
;; no &AUX allowed
- (when aux
+ (when auxp
(error "&AUX is not allowed in a generic function lambda list: ~S"
lambda-list))
;; Oh, *puhlease*... not specifically as per section 3.4.2 of