Function: eieio--slot-name-index

eieio--slot-name-index is a byte-compiled function defined in eieio-core.el.gz.

Signature

(eieio--slot-name-index CLASS SLOT)

Documentation

In CLASS find the index of the named SLOT.

The slot is a symbol which is installed in CLASS by the defclass call. If SLOT is the value created with :initarg instead, reverse-lookup that name, and recurse with the associated slot value.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio-core.el.gz
;;; EIEIO internal search functions
;;
(defun eieio--slot-name-index (class slot)
  "In CLASS find the index of the named SLOT.
The slot is a symbol which is installed in CLASS by the `defclass' call.
If SLOT is the value created with :initarg instead,
reverse-lookup that name, and recurse with the associated slot value."
  ;; Removed checks to outside this call
  (let* ((fsi (gethash slot (cl--class-index-table class))))
    (if (integerp fsi)
        fsi
      (let ((fn (eieio--initarg-to-attribute class slot)))
	(if fn
            ;; Accessing a slot via its :initarg is accepted by EIEIO
            ;; (but not CLOS) but is a bad idea (for one: it's slower).
            (eieio--slot-name-index class fn)
          nil)))))