#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Tue, 28 Aug 2018 11:25:34 +0200
changeset 23303 64f287d03213
parent 23302 a5d66fd32992
child 23304 eb5349cc3973
#REFACTORING by cg class: QuerySignal changed: #accepts: #handles:
QuerySignal.st
--- a/QuerySignal.st	Tue Aug 28 11:18:46 2018 +0200
+++ b/QuerySignal.st	Tue Aug 28 11:25:34 2018 +0200
@@ -366,23 +366,23 @@
 
 !QuerySignal methodsFor:'queries'!
 
-accepts:aSignal
+accepts:aSignalOrExceptionClass
     "return true, if the receiver accepts the argument, aSignal.
      (i.e. the receiver is aSignal or a parent of it). False otherwise."
 
     |s|
 
-    self == aSignal ifTrue:[^ true].
-    aSignal isQuerySignal ifFalse:[^ false].
+    self == aSignalOrExceptionClass ifTrue:[^ true].
+    aSignalOrExceptionClass isQuerySignal ifFalse:[^ false].
 
-    s := aSignal parent.
-    [s notNil] whileTrue:[
+    s := aSignalOrExceptionClass.
+    [(s := s parent) notNil] whileTrue:[
         self == s ifTrue:[^ true].
-        s := s parent
     ].
     ^ false
 
-    "Modified: / 22.3.1999 / 12:45:32 / stefan"
+    "Modified: / 22-03-1999 / 12:45:32 / stefan"
+    "Modified: / 28-08-2018 / 11:16:18 / Claus Gittinger"
 !
 
 defaultAnswer
@@ -416,19 +416,23 @@
     "return true, if the receiver handles the argument, anException.
      (i.e. the receiver is anExceptions signal or a parent of it)"
 
-    |signal|
-
-    signal := anException creator.
+    ^ self accepts:(anException creator).
 
-    self == signal ifTrue:[^ true].         "quick check"
-    anException isQuery ifFalse:[^ false].  "speed up non-queries by not traversing the parent chain"
-
-    [(signal := signal parent) notNil] whileTrue:[
-        self == signal ifTrue:[^ true].
-    ].
-    ^ false
+"/    |signal|
+"/
+"/    signal := anException creator.
+"/    self == signal ifTrue:[^ true].         "quick check"
+"/    anException isQuery ifFalse:[^ false].  "speed up non-queries by not traversing the parent chain"
+"/
+"/    [(signal := signal parent) notNil] whileTrue:[
+"/        self == signal ifTrue:[^ true].
+"/    ].
+"/    ^ false
+"/
+"/
 
     "Modified (format): / 25-07-2017 / 16:11:00 / stefan"
+    "Modified (comment): / 28-08-2018 / 11:24:51 / Claus Gittinger"
 !
 
 isQuery