added #handlingSignalInContext:
authorClaus Gittinger <cg@exept.de>
Sat, 31 Jul 1999 14:41:08 +0200
changeset 4471 f5ca98d3a5d9
parent 4470 8b5faec7deef
child 4472 c5262e0e3130
added #handlingSignalInContext: (see Exception-doRaise)
Block.st
--- a/Block.st	Sat Jul 31 14:37:36 1999 +0200
+++ b/Block.st	Sat Jul 31 14:41:08 1999 +0200
@@ -10,8 +10,6 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:3.5.3 on 26-jul-1999 at 15:32:05'                    !
-
 CompiledCode variableSubclass:#Block
 	instanceVariableNames:'home nargs sourcePos initialPC'
 	classVariableNames:'InvalidNewSignal'
@@ -1040,7 +1038,13 @@
     theContext selector == #on:do: ifTrue:[
         sig := theContext argAt:1.
         (sig accepts:signal) ifTrue:[
-           ^ theContext argAt:2.
+            handler := theContext argAt:2.
+            "/ this is for backward compatibility when no ex-arg
+            "/ is expected in the block. Is it worth the effort ?
+            handler numArgs == 0 ifTrue:[
+                ^ [:ex | handler value]
+            ].
+            ^ handler
         ].
     ] ifFalse:[
         "must be #valueWithExceptionHandler:"
@@ -1054,6 +1058,18 @@
     "Modified: / 26.7.1999 / 14:30:42 / stefan"
 !
 
+handlingSignalInContext:theContext
+    "answer the handling signal from aContext."
+
+    theContext selector == #on:do: ifTrue:[
+        ^ theContext argAt:1.
+    ] ifFalse:[
+        "must be #valueWithExceptionHandler:"
+        ^ theContext argAt:1.
+    ].
+
+!
+
 on:aSignal do:exceptionBlock
     "added for ST/V compatibility; evaluate the receiver,
      handling aSignal. The argument, exceptionBlock is evaluated
@@ -1588,6 +1604,6 @@
 !Block class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.85 1999-07-28 07:53:21 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Block.st,v 1.86 1999-07-31 12:41:08 cg Exp $'
 ! !
 Block initialize!