[squeak-dev] The Inbox: Kernel-ul.1415.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Sep 20 22:21:11 UTC 2021


Levente Uzonyi uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-ul.1415.mcz

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

Name: Kernel-ul.1415
Author: ul
Time: 21 September 2021, 12:15:33.429302 am
UUID: 475b52e5-ca1e-4e9a-bf3f-bdc55f143e01
Ancestors: Kernel-eem.1414

MethodDictionary has to reimplement some inherited methods: #add, #at:ifPresent:ifAbsentPut: and #replace:

=============== Diff against Kernel-eem.1414 ===============

Item was added:
+ ----- Method: MethodDictionary>>add: (in category 'adding') -----
+ add: anAssociation
+ 
+ 	self at: anAssociation key put: anAssociation value.
+ 	^anAssociation!

Item was added:
+ ----- Method: MethodDictionary>>at:ifPresent:ifAbsentPut: (in category 'accessing') -----
+ at: key ifPresent: oneArgBlock ifAbsentPut: absentBlock
+ 	"Lookup the given key in the receiver. If it is present, answer the value of
+ 	 evaluating oneArgBlock with the value associated with the key. Otherwise
+ 	 add the value of absentBlock under the key, and answer that value."
+ 
+ 	| index value |
+ 	index := self scanFor: key.
+ 	(array at: index) ifNotNil: [ :element | ^oneArgBlock value: element value].
+ 	value := absentBlock value.
+ 	self 
+ 		basicAt: index put: key;
+ 		atNewIndex: index put: value.
+ 	^value!

Item was added:
+ ----- Method: MethodDictionary>>replace: (in category 'enumeration') -----
+ replace: aBlock
+ 	"Destructively replace the values in this Dictionary by applying aBlock, keeping the same keys."
+ 
+ 	tally = 0 ifTrue: [ ^self].
+ 	1 to: array size do: [ :index |
+ 		(array at: index) ifNotNil: [ :element |
+ 			array at: index put: (aBlock value: element) ] ]!



More information about the Squeak-dev mailing list