- (pprint-newline :mandatory stream)
- (pprint-logical-block (stream nil)
- (format stream "Methods:")
- (dolist (method methods)
- (pprint-indent :block 2 stream)
- (format stream "~@:_(~A ~{~S ~}~:S)"
- name
- (method-qualifiers method)
- (sb-pcl::unparse-specializers fun (sb-mop:method-specializers method)))
- (pprint-indent :block 4 stream)
- (describe-documentation method t stream nil))))))
- (describe-function-source fun stream)
- (terpri stream)))))
+ (let ((fun (or function (fdefinition name))))
+ (multiple-value-bind (ftype from)
+ (if function
+ (values (%fun-type function) :derived)
+ (let ((ctype (info :function :type name)))
+ (values (when ctype (type-specifier ctype))
+ (when ctype
+ ;; Ensure lazy pickup of information
+ ;; from methods.
+ (sb-c::maybe-update-info-for-gf name)
+ (ecase (info :function :where-from name)
+ (:declared :declared)
+ ;; This is hopefully clearer to users
+ ((:defined-method :defined) :derived))))))
+ (if (typep fun 'generic-function)
+ (values fun
+ "a generic function"
+ (sb-mop:generic-function-lambda-list fun)
+ ftype
+ from
+ nil
+ (or (sb-mop:generic-function-methods fun)
+ :none))
+ (values fun
+ (if (compiled-function-p fun)
+ "a compiled function"
+ "an interpreted function")
+ (%fun-lambda-list fun)
+ ftype
+ from
+ (unless function
+ (cons
+ (info :function :inlinep name)
+ (info :function :inline-expansion-designator name)))))))))
+ (pprint-logical-block (stream nil)
+ (unless function
+ (format stream "~%~A names ~A:" name what)
+ (pprint-indent :block 2 stream))
+ (describe-lambda-list lambda-list stream)
+ (when (and ftype from)
+ (format stream "~@:_~:(~A~) type: ~S" from ftype))
+ (when (eq :declared from)
+ (let ((derived-ftype (%fun-type fun)))
+ (unless (equal derived-ftype ftype)
+ (format stream "~@:_Derived type: ~S" derived-ftype))))
+ (describe-documentation name 'function stream)
+ (when (car inline)
+ (format stream "~@:_Inline proclamation: ~A (~:[no ~;~]inline expansion available)"
+ (car inline)
+ (cdr inline)))
+ (awhen (info :function :info name)
+ (awhen (sb-c::decode-ir1-attributes (sb-c::fun-info-attributes it))
+ (format stream "~@:_Known attributes: ~(~{~A~^, ~}~)" it)))
+ (when methods
+ (format stream "~@:_Method-combination: ~S"
+ (sb-pcl::method-combination-type-name
+ (sb-pcl:generic-function-method-combination fun)))
+ (cond ((eq :none methods)
+ (format stream "~@:_No methods."))
+ (t
+ (pprint-newline :mandatory stream)
+ (pprint-logical-block (stream nil)
+ (format stream "Methods:")
+ (dolist (method methods)
+ (pprint-indent :block 2 stream)
+ (format stream "~@:_(~A ~{~S ~}~:S)"
+ name
+ (method-qualifiers method)
+ (sb-pcl::unparse-specializers fun (sb-mop:method-specializers method)))
+ (pprint-indent :block 4 stream)
+ (describe-documentation method t stream nil))))))
+ (describe-function-source fun stream)
+ (terpri stream)))))