diff options
author | Andrea Corallo <acorallo@gnu.org> | 2024-03-01 09:30:44 +0100 |
---|---|---|
committer | Andrea Corallo <acorallo@gnu.org> | 2024-03-01 09:30:44 +0100 |
commit | c55694785e93212d1da5f96123288e596cb24f53 (patch) | |
tree | 737c364da774e2c3724c04adbd0ff36cacfff22a /lisp/emacs-lisp/comp-cstr.el | |
parent | 4dd4f145b8528d5a742af4268073c24d629801d8 (diff) | |
parent | 4372a056fef90e5927d1a627fe0eb2bb01eb0dfb (diff) | |
download | emacs-c55694785e93212d1da5f96123288e596cb24f53.tar.gz emacs-c55694785e93212d1da5f96123288e596cb24f53.tar.bz2 emacs-c55694785e93212d1da5f96123288e596cb24f53.zip |
Merge branch 'feature/type-hierarchy' into 'master'
Diffstat (limited to 'lisp/emacs-lisp/comp-cstr.el')
-rw-r--r-- | lisp/emacs-lisp/comp-cstr.el | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 48e3645629b..55d92841cd5 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -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." |