]> git.eshelyaron.com Git - emacs.git/commit
cl-types.el: Speed up deftype and dispatch
authorDavid Ponce <da_vid@orange.fr>
Mon, 5 May 2025 15:03:56 +0000 (11:03 -0400)
committerEshel Yaron <me@eshelyaron.com>
Sat, 10 May 2025 08:49:56 +0000 (10:49 +0200)
commit6f5a71349149eb2b4bcfb34e254a16c9385fdfd3
tree60f316b2738321d833feb0914194063b8a02fed9
parent96b7f7c471a857f4c716b35b87350d26c4967987
cl-types.el: Speed up deftype and dispatch

* lisp/emacs-lisp/cl-types.el (cl--type-list): Doc string.
(cl--type-dispatch-list): New variable.
(cl--type-parents): Make it a plain defun.
(cl--type-children, cl--type-dag): Remove.
(cl--type-undefine): Remove duplicate test for `cl--type-p'.  Use
`cl--class-children'.  Clear `cl--type-flag' instead of
`cl--type-error'.  Also remove type from the dispatch list.
(cl--type-deftype): Doc string.  Remove useless safeguard of
data on error.  Fix some error messages.  Clear `cl--type-flag'
when a type is (re)defined.  Just push new types on
`cl--type-list'.
(cl--type-error): Set `cl--type-flag' to the symbol `error' and
remove type in error from the dispatch list.
(cl-types-of): Doc string.  Remove useless check for
`cl-type-class-p'.  Skip types which we are sure will not match.
Simplify creation of the DAG.
(cl--type-generalizer): In the tagcode-function, check only types
that can be dispatched.
(cl-generic-generalizers): Populate the dispatch list.

(cherry picked from commit 8f649c42702144dbbacba180c78ab0df04951807)
lisp/emacs-lisp/cl-types.el