- (error "type name not a symbol: ~S" name))
- (with-unique-names (whole)
- (multiple-value-bind (body local-decs doc)
- (parse-defmacro arglist whole body name 'deftype :default-default ''*)
- `(eval-when (:compile-toplevel :load-toplevel :execute)
+ (bad-type name 'symbol "Type name is not a symbol:~% ~S"
+ form))
+ (multiple-value-bind (expander-form doc source-location-form)
+ (multiple-value-bind (forms decls doc) (parse-body body)
+ ;; FIXME: We could use CONSTANTP here to deal with slightly more
+ ;; complex deftypes using CONSTANT-TYPE-EXPANDER, but that XC:CONSTANTP
+ ;; is not availble early enough.
+ (if (and (not lambda-list) (not decls) (not (cdr forms))
+ (or (member (car forms) '(t nil))
+ (and (consp (car forms)) (eq 'quote (caar forms)))))
+ (values `(constant-type-expander ,(car forms)) doc '(sb!c:source-location))
+ (with-unique-names (whole)
+ (multiple-value-bind (macro-body local-decs doc)
+ (parse-defmacro lambda-list whole body name 'deftype :default-default ''*)
+ (values `(lambda (,whole)
+ ,@local-decs
+ ,macro-body)
+ doc
+ nil)))))
+ `(progn
+ (eval-when (:compile-toplevel :load-toplevel :execute)