File tree Expand file tree Collapse file tree 3 files changed +12
-5
lines changed
repository/Grease-GemStone-Core.package Expand file tree Collapse file tree 3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 11accessing
22use: anObject during: aBlock
3- | p oldValue result |
4- " Proper implementation instead of use 'super value:during:' because that one does not return value, perhaps this should be fixed in DynamicVariable?"
3+ | p hasOldValue oldValue result |
4+ " Implementation cannot send a supercall to value:during: because:
5+ - this method needs to return the value
6+ - the defaultValue may not be invoked here to support throwing errors as defaultValue
7+ - nil may not remain installed as the default value once the block has finished running"
58 p := Processor activeProcess.
9+ hasOldValue := p environment includesKey: self .
610 oldValue := p environmentAt: self .
711 [
812 p environmentAt: self put: anObject.
913 result := aBlock value ]
10- ensure : [ p environmentAt: self put: oldValue ].
14+ ensure : [
15+ hasOldValue
16+ ifFalse: [ p environment removeKey: self ]
17+ ifTrue: [ p environmentAt: self put: oldValue ] ].
1118 ^ result
Original file line number Diff line number Diff line change 22 "class" : {
33 "default" : " JohanBrichau 07/23/2017 09:48" ,
44 "defaultValue" : " JohanBrichau 07/23/2017 09:47" ,
5- "use:during:" : " JohanBrichau 07/23 /2017 07:39 " },
5+ "use:during:" : " JB 09/08 /2017 00:34 " },
66 "instance" : {
77 } }
You can’t perform that action at this time.
0 commit comments