Function: eieio-copy-parents-into-subclass

eieio-copy-parents-into-subclass is a byte-compiled function defined in eieio-core.el.gz.

Signature

(eieio-copy-parents-into-subclass NEWC)

Documentation

Copy into NEWC the slots of PARENTS.

Follow the rules of not overwriting early parents when applying to the new child class.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio-core.el.gz
(defun eieio-copy-parents-into-subclass (newc)
  "Copy into NEWC the slots of PARENTS.
Follow the rules of not overwriting early parents when applying to
the new child class."
  (let ((sn (eieio--class-option-assoc (eieio--class-options newc)
                                       :allow-nil-initform)))
    (dolist (pcv (eieio--class-parents newc))
      ;; First, duplicate all the slots of the parent.
      (let ((pslots (eieio--class-slots pcv))
            (pinit (eieio--class-initarg-tuples pcv)))
        (dotimes (i (length pslots))
	  (let* ((sd (cl--copy-slot-descriptor (aref pslots i)))
                 (init (car (rassq (cl--slot-descriptor-name sd) pinit))))
	    (eieio--add-new-slot newc sd init nil nil sn))
          )) ;; while/let
      ;; Now duplicate all the class alloc slots.
      (let ((pcslots (eieio--class-class-slots pcv)))
        (dotimes (i (length pcslots))
          (eieio--add-new-slot newc (cl--copy-slot-descriptor
                                     (aref pcslots i))
                               nil :class sn)
          )))))