diff options
author | Jan D <jan.h.d@swipnet.se> | 2015-05-17 16:46:34 +0200 |
---|---|---|
committer | Jan D <jan.h.d@swipnet.se> | 2015-05-17 16:46:34 +0200 |
commit | 6445ee0fb751ae2c1dfef900d44721b3d952812f (patch) | |
tree | d43006cb93d9ea7b00ea02aabcd5577c41ff827f /lisp/emacs-lisp/eieio-core.el | |
parent | f92ac2e82ed199d6f25d2a59508e08addb1150ac (diff) | |
parent | c9c4708ed47b18987940a71b98eb9873150d2b95 (diff) | |
download | emacs-6445ee0fb751ae2c1dfef900d44721b3d952812f.tar.gz emacs-6445ee0fb751ae2c1dfef900d44721b3d952812f.tar.bz2 emacs-6445ee0fb751ae2c1dfef900d44721b3d952812f.zip |
Merge branch 'master' into cairo
Diffstat (limited to 'lisp/emacs-lisp/eieio-core.el')
-rw-r--r-- | lisp/emacs-lisp/eieio-core.el | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 59d834837b0..bf3f44206c4 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -88,7 +88,7 @@ Currently under control of this var: (cl-defstruct (eieio--class (:constructor nil) - (:constructor eieio--class-make (name &aux (tag 'defclass))) + (:constructor eieio--class-make (name)) (:include cl--class) (:copier nil)) children @@ -277,12 +277,12 @@ See `defclass' for more information." (setq eieio-hook nil) (let* ((oldc (let ((c (eieio--class-v cname))) (if (eieio--class-p c) c))) - (newc (if (and oldc (not (eieio--class-default-object-cache oldc))) - ;; The oldc class is a stub setup by eieio-defclass-autoload. - ;; Reuse it instead of creating a new one, so that existing - ;; references stay valid. - oldc - (eieio--class-make cname))) + (newc (or oldc + ;; Reuse `oldc' instead of creating a new one, so that + ;; existing references stay valid. E.g. when + ;; reloading the file that does the `defclass', we don't + ;; want to create a new class object. + (eieio--class-make cname))) (groups nil) ;; list of groups id'd from slots (clearparent nil)) @@ -292,7 +292,13 @@ See `defclass' for more information." ;; method table breakage, particularly when the users is only ;; byte compiling an EIEIO file. (if oldc - (setf (eieio--class-children newc) (eieio--class-children oldc)) + (progn + (cl-assert (eq newc oldc)) + ;; Reset the fields. + (setf (eieio--class-parents newc) nil) + (setf (eieio--class-slots newc) nil) + (setf (eieio--class-initarg-tuples newc) nil) + (setf (eieio--class-class-slots newc) nil)) ;; If the old class did not exist, but did exist in the autoload map, ;; then adopt those children. This is like the above, but deals with ;; autoloads nicely. @@ -724,7 +730,7 @@ Argument FN is the function calling this verifier." (cl-check-type slot symbol) (cl-check-type obj (or eieio-object class)) (let* ((class (cond ((symbolp obj) - (error "eieio-oref called on a class!") + (error "eieio-oref called on a class: %s" obj) (let ((c (eieio--class-v obj))) (if (eieio--class-p c) (eieio-class-un-autoload obj)) c)) |