From d31c48f6de3ded5fd3e7ab9ef84890a84e7c07e7 Mon Sep 17 00:00:00 2001 From: Mariano Montone Date: Sun, 28 Aug 2022 11:54:34 -0300 Subject: [PATCH 1/4] Lambda list in function description --- src/clos/describe.lisp | 2 ++ src/compiler/compiler.lisp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) 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..4430e154 100644 --- a/src/compiler/compiler.lisp +++ b/src/compiler/compiler.lisp @@ -265,12 +265,13 @@ (ll-optional-arguments-canonical lambda-list)))) (remove nil (mapcar #'third args)))) -(defun lambda-name/docstring-wrapper (name docstring code) +(defun lambda-name/docstring-wrapper (name docstring lambda-list code) (if (or name docstring) `(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)) code)) @@ -464,7 +465,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)) From 7e94721954268f5ad53f58c7801660c3fa3cc85e Mon Sep 17 00:00:00 2001 From: Mariano Montone Date: Thu, 1 Sep 2022 10:51:19 -0300 Subject: [PATCH 2/4] function-lambda-list --- src/documentation.lisp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/documentation.lisp b/src/documentation.lisp index 6d44ddc5..9e4b50da 100644 --- a/src/documentation.lisp +++ b/src/documentation.lisp @@ -14,6 +14,9 @@ (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." + (read-from-string (oget (fdefinition function) "lambdalist"))) ;;; APROPOS and friends From a9dbec7368a142fa19383ffb3238c60a6ddf63b6 Mon Sep 17 00:00:00 2001 From: Mariano Montone Date: Thu, 1 Sep 2022 13:23:59 -0300 Subject: [PATCH 3/4] Fix function-lambda-list --- src/documentation.lisp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/documentation.lisp b/src/documentation.lisp index 9e4b50da..0b8394bc 100644 --- a/src/documentation.lisp +++ b/src/documentation.lisp @@ -16,7 +16,9 @@ (defun function-lambda-list (function) "Return the lambda-list of FUNCTION." - (read-from-string (oget (fdefinition function) "lambdalist"))) + (let ((lambda-list (oget (fdefinition function) "lambdalist"))) + (when lambda-list + (read-from-string lambda-list)))) ;;; APROPOS and friends From 2514864d7b4bbd8e981a78e32b1376e52ce6521b Mon Sep 17 00:00:00 2001 From: Mariano Montone Date: Thu, 1 Sep 2022 14:07:36 -0300 Subject: [PATCH 4/4] Assign lambda-lists to anonymous lambdas --- src/compiler/compiler.lisp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/compiler/compiler.lisp b/src/compiler/compiler.lisp index 4430e154..c70f2897 100644 --- a/src/compiler/compiler.lisp +++ b/src/compiler/compiler.lisp @@ -266,14 +266,12 @@ (remove nil (mapcar #'third args)))) (defun lambda-name/docstring-wrapper (name docstring lambda-list code) - (if (or name docstring) - `(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)) - 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)