Function: eieio-oref
eieio-oref is a byte-compiled function defined in eieio-core.el.gz.
Signature
(eieio-oref OBJ SLOT)
Documentation
Return the value in OBJ at SLOT in the object vector.
This function has :around advice: eieio-oref@closql-object.
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio-core.el.gz
(defun eieio-oref (obj slot)
"Return the value in OBJ at SLOT in the object vector."
(declare (compiler-macro eieio--check-slot-name)
;; FIXME: Make it a gv-expander such that the hash-table lookup is
;; only performed once when used in `push' and friends?
(gv-setter eieio-oset))
(cl-check-type slot symbol)
(cond
((cl-typep obj '(or eieio-object cl-structure-object))
(let* ((class (eieio--object-class obj))
(c (eieio--slot-name-index class slot)))
(if (not c)
;; It might be missing because it is a :class allocated slot.
;; Let's check that info out.
(if (and (eieio--class-p class)
(setq c (eieio--class-slot-name-index class slot)))
;; Oref that slot.
(aref (eieio--class-class-allocation-values class) c)
;; The slot-missing method is a cool way of allowing an object author
;; to intercept missing slot definitions. Since it is also the LAST
;; thing called in this fn, its return value would be retrieved.
(slot-missing obj slot 'oref))
(eieio-barf-if-slot-unbound (aref obj c) obj slot 'oref))))
((cl-typep obj 'oclosure) (oclosure--slot-value obj slot))
(t
(signal 'wrong-type-argument
(list '(or eieio-object cl-structure-object oclosure) obj)))))