Function: eieio--class-slot-name-index

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

Signature

(eieio--class-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
(defun eieio--class-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."
  ;; This will happen less often, and with fewer slots.  Do this the
  ;; storage cheap way.
  (let ((index nil)
        (slots (eieio--class-class-slots class)))
    (dotimes (i (length slots))
      (if (eq slot (cl--slot-descriptor-name (aref slots i)))
          (setq index i)))
    index))