--- a/BlockValue.st Fri Nov 08 13:47:10 2002 +0100
+++ b/BlockValue.st Mon Nov 11 10:38:53 2002 +0100
@@ -11,6 +11,8 @@
"
+"{ Package: 'stx:libview2' }"
+
ValueModel subclass:#BlockValue
instanceVariableNames:'cachedValue arguments block'
classVariableNames:'NeverComputed'
@@ -305,7 +307,7 @@
computeValue
"evaluate the receivers action block"
- |sz|
+ |sz arg1 arg2 argValues|
arguments isNil ifTrue:[
^ block value
@@ -314,20 +316,21 @@
sz == 0 ifTrue:[
^ block value
].
+ arg1 := (arguments at:1) value.
sz == 1 ifTrue:[
- ^ block value:(arguments at:1) value
+ ^ block value:arg1
].
+ arg2 := (arguments at:2) value.
sz == 2 ifTrue:[
- ^ block value:(arguments at:1) value
- value:(arguments at:2) value
+ ^ block value:arg1 value:arg2 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
+ "/ do not evaluate arg[1-2] twice
+ argValues := Array new:arguments size.
+ argValues at:1 put:arg1. "/ do not evaluate twice
+ argValues at:2 put:arg2. "/ do not evaluate twice
+ 3 to:arguments size do:[:i | argValues at:i put:(arguments at:i) value].
+
+ ^ block valueWithArguments:argValues
"Created: 16.12.1995 / 19:27:40 / cg"
"Modified: 22.1.1997 / 19:05:57 / cg"
@@ -468,6 +471,7 @@
!BlockValue class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/BlockValue.st,v 1.17 2000-02-17 15:00:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/BlockValue.st,v 1.18 2002-11-11 09:38:53 cg Exp $'
! !
+
BlockValue initialize!