allow valueHolder(s) as arg(s)
authorca
Wed, 05 Mar 1997 17:09:43 +0100
changeset 491 c5174fe6f09c
parent 490 ebe88e50b29a
child 492 4a308c56cb06
allow valueHolder(s) as arg(s)
BlockValue.st
--- a/BlockValue.st	Wed Mar 05 17:06:31 1997 +0100
+++ b/BlockValue.st	Wed Mar 05 17:09:43 1997 +0100
@@ -246,6 +246,37 @@
 
 !BlockValue methodsFor:'accessing'!
 
+computeValue
+    "evaluate the receivers action block"
+
+    |sz|
+
+    arguments isNil ifTrue:[
+        ^ block value
+    ].
+    sz := arguments size.
+    sz == 0 ifTrue:[
+        ^ block value
+    ].
+    sz == 1 ifTrue:[
+        ^ block value:(arguments at:1) value
+    ].
+    sz == 2 ifTrue:[
+        ^ block value:(arguments at:1) value
+                value:(arguments at:2) value
+    ].
+    sz == 3 ifTrue:[
+        ^ block value:(arguments at:1) value
+                value:(arguments at:2) value
+                value:(arguments at:3) value
+    ].
+    ^ block 
+        valueWithArguments:(arguments collect:[:arg | arg value]) asArray
+
+    "Created: 16.12.1995 / 19:27:40 / cg"
+    "Modified: 22.1.1997 / 19:05:57 / cg"
+!
+
 dependOn:someObject
     "arrange for the blockValue to be reevaluated, whenever someObject
      changes (i.e. sends a change notification)"
@@ -340,7 +371,7 @@
      since the returned value is cached internally"
 
     cachedValue == NeverComputed ifTrue:[
-        cachedValue := self evaluate
+        cachedValue := self computeValue
     ].
     ^ cachedValue
 
@@ -357,7 +388,7 @@
     |oldValue|
 
     oldValue := cachedValue.
-    cachedValue := self evaluate.
+    cachedValue := self computeValue.
     oldValue ~~ cachedValue ifTrue:[
         self changed:#value
     ].
@@ -381,6 +412,6 @@
 !BlockValue class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/BlockValue.st,v 1.9 1997-01-23 03:26:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/BlockValue.st,v 1.10 1997-03-05 16:09:43 ca Exp $'
 ! !
 BlockValue initialize!