summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp-cstr.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/comp-cstr.el')
-rw-r--r--lisp/emacs-lisp/comp-cstr.el25
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el
index 2984bedb1dd..0a8b3b7efb2 100644
--- a/lisp/emacs-lisp/comp-cstr.el
+++ b/lisp/emacs-lisp/comp-cstr.el
@@ -270,18 +270,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."