Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-mt.1243.mcz==================== Summary ====================
Name: Kernel-mt.1243
Author: mt
Time: 12 July 2019, 9:56:47.949568 am
UUID: 741f1855-ce1a-4d48-b741-9eeed6a4d7a0
Ancestors: Kernel-eem.1242
Refactoring of #literalsDo: - Step 1 of 3.
For more information, see
http://forum.world.st/Please-Review-Refactoring-for-literalsDo-etc-tp5099756p5100896.html.
=============== Diff against Kernel-eem.1242 ===============
Item was added:
+ ----- Method: AdditionalMethodState>>allLiteralsDo: (in category 'literals') -----
+ allLiteralsDo: aBlock
+
+ 1 to: self basicSize do: [:index |
+ (self basicAt: index) allLiteralsDo: aBlock].!
Item was added:
+ ----- Method: Object>>allLiteralsDo: (in category 'literals') -----
+ allLiteralsDo: aBlock
+
+ self flag: #discuss. "mt: Better implement this only on Symbol, Array, Number, Binding, etc. instead of Object?"
+ aBlock value: self.!
Item was added:
+ ----- Method: Object>>hasLiteral: (in category 'literals') -----
+ hasLiteral: literal
+
+ ^ self hasLiteralSuchThat: [:lit | lit literalEqual: literal]!
Item was changed:
+ ----- Method: Object>>hasLiteralSuchThat: (in category 'literals') -----
- ----- Method: Object>>hasLiteralSuchThat: (in category 'testing') -----
hasLiteralSuchThat: testBlock
- "This is the end of the imbedded structure path so return false."
+ self allLiteralsDo: [:literal |
+ (testBlock value: literal) ifTrue: [^ true]].
+
^ false!
Item was added:
+ ----- Method: Pragma>>allLiteralsDo: (in category 'literals') -----
+ allLiteralsDo: aBlock
+
+ keyword allLiteralsDo: aBlock.
+ arguments allLiteralsDo: aBlock.!
Item was changed:
+ ----- Method: Pragma>>hasLiteral: (in category 'literals') -----
- ----- Method: Pragma>>hasLiteral: (in category 'testing') -----
hasLiteral: aLiteral
+ "Extra support for #hasLiteralTest:."
+
+ ^ (super hasLiteral: aLiteral)
- ^keyword == aLiteral
- or: [(arguments hasLiteral: aLiteral)
or: [keyword == #hasLiteralTest: and: [
+ self methodClass theNonMetaClass perform: arguments first with: aLiteral]]!
- self methodClass theNonMetaClass perform: arguments first with: aLiteral]]]!