Marcel Taeumel uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1285.mcz==================== Summary ====================
Name: Kernel-eem.1285
Author: eem
Time: 11 December 2019, 11:50:19.928718 am
UUID: 3dce70bd-9166-47fe-a86f-22456db9845a
Ancestors: Kernel-mt.1284
Commit my own take on sendsSelector: vs sendsMessage:, and selectorsDo: vs messagesDo:. IMNERHO sendsMessage: messagesDo: are *wrong*!! :-) c.f. Behavior>>selectorsDo:
=============== Diff against Kernel-mt.1284 ===============
Item was changed:
----- Method: CompiledCode>>messagesDo: (in category 'scanning') -----
messagesDo: workBlock
+ "Evaluate aBlock with all the message selectors sent by me. Duplicate seletors are possible."
- "Evaluate aBlock with all the message selectors sent by me. Duplicate sends possible."
+ "If anything should be deprecated it is messagesDo:; it can be an extension in AST/Refactoring.
+ This method enumerates over selectors, not messages. c.f. Behavior>>selectorsDo: etc"
+ ^self selectorsDo: workBlock!
- | scanner selector |
- self isQuick ifTrue: [^ self].
-
- self codeLiteralsDo: [:compiledCode |
- scanner := InstructionStream on: compiledCode.
- scanner scanFor: [ :x |
- (selector := scanner selectorToSendOrSelf) == scanner
- ifFalse: [workBlock value: selector].
- false "keep scanning" ] ].!
Item was added:
+ ----- Method: CompiledCode>>selectorsDo: (in category 'scanning') -----
+ selectorsDo: workBlock
+ "Evaluate aBlock with all the message selectors sent by me. Duplicate seletors are possible."
+
+ self isQuick ifTrue: [^self].
+
+ self codeLiteralsDo:
+ [:compiledCode | | scanner |
+ (scanner := InstructionStream on: compiledCode) scanFor:
+ [:x| | selector |
+ (selector := scanner selectorToSendOrSelf) ~~ scanner ifTrue:
+ [workBlock value: selector].
+ false "keep scanning"]]!
Item was changed:
----- Method: CompiledCode>>sendsMessage: (in category 'testing') -----
+ sendsMessage: aSelector
+ "eem: this should be deprecated. This method does not check if a method sends a message;
+ it checks if a method sends a message with a particular selector."
+ self flag: #todo.
- sendsMessage: aSelector
-
self messagesDo: [:selector |
selector = aSelector ifTrue: [^ true]].
^ false!
Item was changed:
----- Method: CompiledCode>>sendsSelector: (in category 'testing') -----
sendsSelector: aSelector
+ "Answer if the receiver sends a message whose selector is aSelector."
+ self selectorsDo:
+ [:selector | selector = aSelector ifTrue: [^true]].
+ ^false!
- self flag: #todo. "mt: Deprecate? AST/Refactoring project needs it..."
- ^ self sendsMessage: aSelector!