QuerySignal generates Notifications instead of Exceptions.
authorStefan Vogel <sv@exept.de>
Fri, 21 Jan 2005 11:24:24 +0100
changeset 8683 a162510a0408
parent 8682 3bbf34191ca2
child 8684 9c00854305f7
QuerySignal generates Notifications instead of Exceptions. Implement the same set of #raise... methods in GenericException class and Signal. Remove unsed instance variable from signal. Save some message sends when raising signals.
Notification.st
--- a/Notification.st	Thu Jan 20 13:27:37 2005 +0100
+++ b/Notification.st	Fri Jan 21 11:24:24 2005 +0100
@@ -215,17 +215,18 @@
      Invoking the handler is exactly the functionality of Signal>>raiseRequest,
      but we can do it faster here."
 
-    |con s|
+    |con signal|
 
     con := Context findFirstSpecialHandle:true raise:false.
     [con notNil] whileTrue:[
         (con selector == #answer:do:) ifFalse:[
             ^ super raiseRequest
         ].
-        (s := con receiver) == self ifTrue:[
+        signal := con receiver.
+        signal == self ifTrue:[
             ^ con argAt:1
         ].
-        (s == self or:[s accepts:self]) ifTrue:[
+        (signal accepts:self) ifTrue:[
             ^ super raiseRequest
         ].
         con := con findSpecialHandle:true raise:false.
@@ -261,6 +262,15 @@
     "the default action is to return the default value.
      Subclasses may redefine this"
 
+    |handlerBlock|
+
+    "try per signal handler.
+     I may have been created from a QuerySignal"
+
+    (handlerBlock := signal handlerBlock) notNil ifTrue:[
+        "... and call it"
+        ^ handlerBlock value:self.
+    ].
     ^ self defaultResumeValue
 
     "Modified: / 23.7.1999 / 15:13:34 / stefan"
@@ -275,7 +285,7 @@
 !Notification class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Notification.st,v 1.14 2005-01-20 12:26:11 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Notification.st,v 1.15 2005-01-21 10:24:24 stefan Exp $'
 ! !
 
 Notification initialize!