From f3af5f8a4a0ec2a7a95cd2fc8d577940b6cf2584 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 25 Mar 2025 02:09:48 -0400 Subject: [PATCH] (built-in-class--make): Take list of types rather than classes Consolidate the conversion from types to classes into `built-in-class--make` instead of duplicating it in ever caller. * lisp/emacs-lisp/cl-preloaded.el (built-in-class--make): Take list of types rather than classes. (cl--define-built-in-type): Simplify accordingly. (cherry picked from commit 7ec0ee742da17864b554e2cf4384d2a12baaf1e8) --- lisp/emacs-lisp/cl-preloaded.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el index 7017fcd5b83..dfea8d6c8e3 100644 --- a/lisp/emacs-lisp/cl-preloaded.el +++ b/lisp/emacs-lisp/cl-preloaded.el @@ -292,7 +292,13 @@ (:include cl--class) (:noinline t) (:constructor nil) - (:constructor built-in-class--make (name docstring parents)) + (:constructor built-in-class--make + (name docstring parent-types + &aux (parents + (mapcar (lambda (type) + (or (get type 'cl--class) + (error "Unknown type: %S" type))) + parent-types)))) (:copier nil)) "Type descriptors for built-in types. The `slots' (and hence `index-table') are currently unused." @@ -322,13 +328,7 @@ The `slots' (and hence `index-table') are currently unused." ;; (message "Missing predicate for: %S" name) nil) (put ',name 'cl--class - (built-in-class--make ',name ,docstring - (mapcar (lambda (type) - (let ((class (get type 'cl--class))) - (unless class - (error "Unknown type: %S" type)) - class)) - ',parents)))))) + (built-in-class--make ',name ,docstring ',parents))))) ;; FIXME: Our type DAG has various quirks: ;; - Some `keyword's are also `symbol-with-pos' but that's not reflected -- 2.39.5