diff --git a/src/clos/describe.lisp b/src/clos/describe.lisp index eeccfd28..2a4aceec 100644 --- a/src/clos/describe.lisp +++ b/src/clos/describe.lisp @@ -276,10 +276,12 @@ ;;; function (defmethod describe ((obj function) &optional (stream *standard-output*)) (let ((name (oget obj "fname")) + (lambda-list (oget obj "lambdalist")) (doc (oget obj "docstring"))) (with-pp-buffer (buf) (pp/presentation obj 'function stream) (format buf "Name:~a~%" (if name name "anonimous")) + (format buf "Lambda list:~a~%" lambda-list) (when doc (format buf "Documentation: ~a~%" doc)) (flush-pp-buffer buf stream)) diff --git a/src/compiler/compiler.lisp b/src/compiler/compiler.lisp index bf993bc5..c70f2897 100644 --- a/src/compiler/compiler.lisp +++ b/src/compiler/compiler.lisp @@ -265,14 +265,13 @@ (ll-optional-arguments-canonical lambda-list)))) (remove nil (mapcar #'third args)))) -(defun lambda-name/docstring-wrapper (name docstring code) - (if (or name docstring) - `(selfcall - (var (func ,code)) - ,(when name `(= (get func "fname") ,name)) - ,(when docstring `(= (get func "docstring") ,docstring)) - (return func)) - code)) +(defun lambda-name/docstring-wrapper (name docstring lambda-list code) + `(selfcall + (var (func ,code)) + ,(when name `(= (get func "fname") ,name)) + ,(when docstring `(= (get func "docstring") ,docstring)) + (= (get func "lambdalist") ,(prin1-to-string lambda-list)) + (return func))) (defun lambda-check-argument-count (n-required-arguments n-optional-arguments rest-p) @@ -464,7 +463,7 @@ keyword-arguments (ll-svars ll))))) - (lambda-name/docstring-wrapper name documentation + (lambda-name/docstring-wrapper name documentation ll `(named-function ,(jsize-symbol name 'jscl_user_) (|values| ,@(mapcar (lambda (x) (translate-variable x)) diff --git a/src/documentation.lisp b/src/documentation.lisp index 6d44ddc5..0b8394bc 100644 --- a/src/documentation.lisp +++ b/src/documentation.lisp @@ -14,6 +14,11 @@ (error "The type of documentation `~S' is not a symbol." type)) (oget x "vardoc")))) +(defun function-lambda-list (function) + "Return the lambda-list of FUNCTION." + (let ((lambda-list (oget (fdefinition function) "lambdalist"))) + (when lambda-list + (read-from-string lambda-list)))) ;;; APROPOS and friends