The Trunk: Tools-ul.742.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-ul.742.mcz

commits-2
Levente Uzonyi uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-ul.742.mcz

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

Name: Tools-ul.742
Author: ul
Time: 25 December 2016, 11:06:07.791123 pm
UUID: 5824e7da-a2e2-49e6-b445-bbf97bdaff56
Ancestors: Tools-nice.741

Simplified and removed the duplicate selector from the results of StringHolder >> #withSelectorAndMessagesIn:evaluate:.

=============== Diff against Tools-nice.741 ===============

Item was changed:
  ----- Method: StringHolder>>withSelectorAndMessagesIn:evaluate: (in category '*Tools') -----
  withSelectorAndMessagesIn: aCompiledMethod evaluate: aBlock
  "Allow the user to choose one selector, chosen from the currently selected message's selector, as well as those of all messages sent by it, and evaluate aBlock on behalf of chosen selector.  If there is only one possible choice, simply make it; if there are multiple choices, put up a menu, and evaluate aBlock on behalf of the the chosen selector, doing nothing if the user declines to choose any"
 
+ | selectorOrNil messages |
+ selectorOrNil := aCompiledMethod selector.
+ messages := SystemNavigation thoroughSenders
+ ifTrue: [
+ | litGetter |
+ litGetter := [:set :l|
+ (l isSymbol and: [l size > 0 and: [l first isLowercase]]) ifTrue:
+ [set add: l].
+ l isArray ifTrue:
+ [l inject: set into: litGetter].
+ set].
+ aCompiledMethod allLiterals,
+ (aCompiledMethod pragmas collect: [:pragma| pragma keyword])
+ inject: aCompiledMethod messages into: litGetter]
+ ifFalse: [aCompiledMethod messages].
+ messages remove: selectorOrNil ifAbsent: [ "do nothing" ].
+ messages ifEmpty: [  "If only one item, there is no choice"
+ ^selectorOrNil ifNotNil: [ aBlock value: selectorOrNil ] ].
- | selectorOrNil litGetter messages |
- selectorOrNil := aCompiledMethod selector.
- messages := SystemNavigation thoroughSenders
- ifTrue:
- [litGetter := [:set :l|
- (l isSymbol and: [l size > 0 and: [l first isLowercase]]) ifTrue:
- [set add: l].
- l isArray ifTrue:
- [l inject: set into: litGetter copy].
- set].
- aCompiledMethod allLiterals
- , (aCompiledMethod pragmas collect: [:pragma| pragma keyword])
- inject: aCompiledMethod messages into: litGetter copy]
- ifFalse: [aCompiledMethod messages].
- (messages isEmpty "if no messages, use only selector"
- or: [messages size = 1 and: [messages includes: selectorOrNil]]) ifTrue:
- [^selectorOrNil ifNotNil: [aBlock value: selectorOrNil]].  "If only one item, there is no choice"
-
  self systemNavigation
  showMenuOf: messages
  withFirstItem: selectorOrNil
  ifChosenDo: aBlock!