[squeak-dev] The Trunk: Collections-eem.784.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 10 01:18:54 UTC 2018


Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.784.mcz

==================== Summary ====================

Name: Collections-eem.784
Author: eem
Time: 9 March 2018, 5:18:51.529302 pm
UUID: 1862bd2e-3307-4973-b7b1-c8f6ad8d5f53
Ancestors: Collections-ul.783

Provide more efficient implementation(s) of at:ifPresent:ifAbsent: given impending use in the Compiler.

=============== Diff against Collections-ul.783 ===============

Item was changed:
  ----- Method: Dictionary>>at:ifPresent:ifAbsent: (in category 'accessing') -----
  at: key ifPresent: oneArgBlock ifAbsent: absentBlock
+ 	"Lookup the given key in the receiver. If it is present, answer the
+ 	 value of evaluating the oneArgBlock with the value associated
+ 	 with the key, otherwise answer the value of absentBlock."
+ 	^(array at: (self scanFor: key))
+ 		ifNil: [absentBlock value]
+ 		ifNotNil: [:association| oneArgBlock value: association value]!
- 	"Lookup the given key in the receiver. If it is present, answer the value of evaluating the oneArgBlock with the value associated with the key, otherwise answer the value of absentBlock."
- 	self at: key ifPresent:[:v| ^oneArgBlock value: v].
- 	^absentBlock value!

Item was added:
+ ----- Method: WeakIdentityDictionary>>at:ifPresent:ifAbsent: (in category 'accessing') -----
+ at: key ifPresent: oneArgBlock ifAbsent: absentBlock
+ 	"Lookup the given key in the receiver. If it is present, answer the
+ 	 value of evaluating the oneArgBlock with the value associated
+ 	 with the key, otherwise answer the value of absentBlock."
+ 	^(array at: (self scanFor: key))
+ 		ifNil: [absentBlock value]
+ 		ifNotNil:
+ 			[:association|
+ 			 association == vacuum
+ 				ifTrue: [absentBlock value]
+ 				ifFalse: [oneArgBlock value: association value]]!



More information about the Squeak-dev mailing list