Skip to content
Permalink
Browse files

Allow specifying var of handler class binding in define-handler

  • Loading branch information...
Shinmera committed Jul 11, 2019
1 parent c5c5d93 commit 200c71fbc011cad240c16ce180c6b82316504de0
Showing with 12 additions and 11 deletions.
  1. +12 −11 subject.lisp
@@ -132,17 +132,18 @@
(defmacro define-handler ((class name &optional (event-type name) (priority 0)) args &body body)
(let ((event (first args))
(args (rest args)))
`(add-handler (make-instance
'subject-handler
:name ',name
:event-type ',event-type
:subject ',class
:priority ,priority
:delivery-function (lambda (,class ,event)
(declare (ignorable ,class ,event))
(with-slots ,args ,event
,@body)))
',class)))
(destructuring-bind (var class) (enlist class class)
`(add-handler (make-instance
'subject-handler
:name ',name
:event-type ',event-type
:subject ',class
:priority ,priority
:delivery-function (lambda (,var ,event)
(declare (ignorable ,var ,event))
(with-slots ,args ,event
,@body)))
',class))))

(defmacro define-generic-handler ((class name &optional (event-type name) (priority 0)) &body options)
`(progn

0 comments on commit 200c71f

Please sign in to comment.
You can’t perform that action at this time.