Permalink
Browse files

Fix metaclass propagation

  • Loading branch information...
Shinmera committed Nov 1, 2018
1 parent 9a0dc4f commit 297e62fd935f4a3a068107f9864d18d57d284f0d
Showing with 32 additions and 3 deletions.
  1. +11 −1 shader-entity.lisp
  2. +9 −2 subject.lisp
  3. +12 −0 toolkit.lisp
@@ -78,6 +78,10 @@
(first effective-superclasses)
class))))
(defmethod reinitialize-instance :after ((class subject-class) &key)
(cascade-class-changes class (lambda (class)
(setf (effective-handlers class) (compute-effective-handlers class)))))
(defmethod c2mop:finalize-inheritance :after ((class shader-entity-class))
(dolist (super (c2mop:class-direct-superclasses class))
(unless (c2mop:class-finalized-p super)
@@ -86,9 +90,15 @@
(setf (effective-shader-class class) (compute-effective-shader-class class))
(handle (make-instance 'class-changed :changed-class class) T))
(defmethod apply-class-changes ((class shader-entity-class))
(call-next-method)
(setf (effective-shaders class) (compute-effective-shaders class))
(setf (effective-shader-class class) (compute-effective-shader-class class))
(handle (make-instance 'class-changed :changed-class class) T))
(defmethod (setf direct-shaders) :after (value (class shader-entity-class))
(when (c2mop:class-finalized-p class)
(c2mop:finalize-inheritance class)))
(apply-class-changes class)))
(defmethod effective-shaders ((class symbol))
(effective-shaders (find-class class)))
@@ -30,19 +30,26 @@
(pushnew handler effective-handlers :key #'name)))
finally (return effective-handlers)))
(defmethod reinitialize-instance :after ((class subject-class) &key)
(apply-class-changes class))
(defmethod c2mop:finalize-inheritance :after ((class subject-class))
(dolist (super (c2mop:class-direct-superclasses class))
(unless (c2mop:class-finalized-p super)
(c2mop:finalize-inheritance super)))
(setf (effective-handlers class) (compute-effective-handlers class)))
(defmethod apply-class-changes ((class subject-class))
(call-next-method)
(setf (effective-handlers class) (compute-effective-handlers class)))
(defmethod add-handler :after (handler (class subject-class))
(when (c2mop:class-finalized-p class)
(reinitialize-instance class)))
(apply-class-changes class)))
(defmethod remove-handler :after (handler (class subject-class))
(when (c2mop:class-finalized-p class)
(reinitialize-instance class)))
(apply-class-changes class)))
(defmethod add-handler (handler (class symbol))
(add-handler handler (find-class class)))
@@ -28,6 +28,18 @@
(error (err) (declare (ignore err))
:unavailable)))
(defmethod apply-class-changes ((class standard-class)))
(defmethod apply-class-changes :before ((class standard-class))
(dolist (super (c2mop:class-direct-superclasses class))
(unless (c2mop:class-finalized-p super)
(c2mop:finalize-inheritance super))))
(defmethod apply-class-changes :after ((class standard-class))
(make-instances-obsolete class)
(dolist (sub (c2mop:class-direct-subclasses class))
(apply-class-changes sub)))
;; FIXME: put into a library
(defconstant single-float-positive-infinity
#+sbcl sb-ext:single-float-positive-infinity

0 comments on commit 297e62f

Please sign in to comment.