Block.st
changeset 21662 03adeaeac78f
parent 21558 c5402866df43
child 21667 f77efdbadc44
--- a/Block.st	Sat Mar 18 19:00:13 2017 +0100
+++ b/Block.st	Sat Mar 18 19:00:40 2017 +0100
@@ -403,6 +403,7 @@
 ! !
 
 
+
 !Block methodsFor:'Compatibility-ANSI'!
 
 argumentCount
@@ -566,22 +567,14 @@
     |numArgs|
 
     numArgs := handlerBlock isBlock ifTrue:[handlerBlock argumentCount] ifFalse:[0].
-    numArgs == 1 ifTrue:[
+    numArgs <= 1 ifTrue:[
         ^ self on:Error do:handlerBlock
     ].
 
     ^ self
         on:Error
         do:[:ex |
-            |errString errReceiver|
-
-            numArgs == 0 ifTrue:[
-                ex return:handlerBlock value
-            ] ifFalse:[
-                errString := ex description.
-                errReceiver := ex suspendedContext receiver.
-                ex return:(handlerBlock value:errString value:errReceiver)
-            ].
+            ex return:(handlerBlock value:ex description value:ex suspendedContext receiver)
         ]
 
     "
@@ -604,6 +597,8 @@
      a := 0.
      [ 123 / a ] ifError:[self halt]
     "
+
+    "Modified: / 18-03-2017 / 18:19:20 / stefan"
 !
 
 timeToRun
@@ -709,6 +704,7 @@
 ! !
 
 
+
 !Block methodsFor:'accessing'!
 
 home
@@ -3320,6 +3316,14 @@
     ^ true
 !
 
+isBlockWithArgumentCount:count
+    "return true, if this is a block with count args"
+
+    ^ nargs == count
+
+    "Created: / 18-03-2017 / 18:07:03 / stefan"
+!
+
 isCheapBlock
     ^ false
 !