]> git.eshelyaron.com Git - emacs.git/commitdiff
* make use of 'cl--direct-supertypes-of-type' in the native-compiler
authorAndrea Corallo <acorallo@gnu.org>
Thu, 15 Feb 2024 15:13:16 +0000 (16:13 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sat, 2 Mar 2024 06:28:48 +0000 (07:28 +0100)
* lisp/emacs-lisp/comp-cstr.el (comp--direct-supertypes): Use
cl--direct-supertypes-of-type.

(cherry picked from commit aa849984896ce393afe92dd4fb7fbce494e131a4)

lisp/emacs-lisp/comp-cstr.el

index 48e3645629b7e4c94eb0de155d5b1a36d96ea338..55d92841cd52c0e667396577a87f14d8b3ae2d4b 100644 (file)
@@ -272,18 +272,19 @@ Return them as multiple value."
                 (symbol-name y)))
 
 (defun comp--direct-supertypes (type)
-  "Return the direct supertypes of TYPE."
-  (let ((supers (comp-supertypes type)))
-    (cl-assert (eq type (car supers)))
-    (cl-loop
-     with notdirect = nil
-     with direct = nil
-     for parent in (cdr supers)
-     unless (memq parent notdirect)
-     do (progn
-          (push parent direct)
-          (setq notdirect (append notdirect (comp-supertypes parent))))
-     finally return direct)))
+  (or
+   (gethash type cl--direct-supertypes-of-type)
+   (let ((supers (comp-supertypes type)))
+     (cl-assert (eq type (car supers)))
+     (cl-loop
+      with notdirect = nil
+      with direct = nil
+      for parent in (cdr supers)
+      unless (memq parent notdirect)
+        do (progn
+             (push parent direct)
+             (setq notdirect (append notdirect (comp-supertypes parent))))
+      finally return direct))))
 
 (defsubst comp-subtype-p (type1 type2)
   "Return t if TYPE1 is a subtype of TYPE2 or nil otherwise."