]> git.eshelyaron.com Git - emacs.git/commit
OClosure: add support for `slot-value`
authorStefan Monnier <monnier@iro.umontreal.ca>
Mon, 4 Apr 2022 19:06:47 +0000 (15:06 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Mon, 4 Apr 2022 19:06:47 +0000 (15:06 -0400)
commit1f4f6b956bee611ffa406b3851e5264ee74e3bfb
tree4d24cdef860e41b611c400492ef4a85b9a1b156a
parent6c4a4cc94e9fea809b518da9fe9e581a6031a6df
OClosure: add support for `slot-value`

* lisp/emacs-lisp/oclosure.el (oclosure--slot-index)
(oclosure--slot-value, oclosure--set-slot-value): New functions.

* lisp/emacs-lisp/eieio-core.el (eieio-oset, eieio-oref):
Consolidate the type test.  Use `oclosure--(set-)slot-value`.
(eieio--validate-slot-value, eieio--validate-class-slot-value):
Don't presume `class` is an EIEIO class.
(eieio--class): Fix bogus `:type` info.
(eieio--object-class): Simplify.
(eieio--known-slot-name-p): New function.
(eieio-oref, eieio-oref-default, eieio-oset-default): Use it.

* test/lisp/emacs-lisp/oclosure-tests.el: Require `eieio`.
(oclosure-test): Make `name` field mutable.
(oclosure-test-slot-value): New test.
lisp/emacs-lisp/eieio-core.el
lisp/emacs-lisp/oclosure.el
test/lisp/emacs-lisp/oclosure-tests.el