The Trunk: Tools-mt.853.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-mt.853.mcz

commits-2
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.853.mcz

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

Name: Tools-mt.853
Author: mt
Time: 12 July 2019, 10:03:14.831568 am
UUID: 6166ceba-b1a9-6e48-97bc-f3b4c09a508c
Ancestors: Tools-mt.852

Refactoring of #literalsDo: - Step 3 of 3.

For more information, see http://forum.world.st/Please-Review-Refactoring-for-literalsDo-etc-tp5099756p5100896.html.

=============== Diff against Tools-mt.852 ===============

Item was changed:
  ----- Method: Behavior>>toolIconSelector: (in category '*Tools-icons') -----
  toolIconSelector: aSymbol
  "Tools can annotate the method identified by aSymbol with an icon identified by the symbol this method returns.
  We customize this for, eg, overriden methods or methods with breaks.
  Defaults to no icon"
 
  self methodDictionary at: aSymbol ifPresent: [ :method |
  method hasBreakpoint ifTrue: [^ #breakpoint].
+ method messagesDo: [:messageSelector |
+ (#(halt halt: haltIfNil haltIf: haltOnce haltOnce: haltOnCount: halt:onCount: break) includes: messageSelector)
- method literalsDo: [:literal |
- (#(halt halt: haltIfNil haltIf: haltOnce haltOnce: haltOnCount: halt:onCount: break) includes: literal)
  ifTrue: [^ #breakpoint].
+ (#(flag: needsWork notYetImplemented) includes: messageSelector)
- (#(flag: needsWork notYetImplemented) includes: literal)
  ifTrue: [^ #flag].
+ (#(shouldBeImplemented subclassResponsibility) includes: messageSelector)
- (#(shouldBeImplemented subclassResponsibility) includes: literal)
  ifTrue: [
  (self isSelectorOverridden: aSymbol)
  ifTrue: [^ #abstract]
  ifFalse: [^ #notOverridden]].
+ messageSelector == #shouldNotImplement
- literal == #shouldNotImplement
  ifTrue: [^ #no]].
  method hasReportableSlip ifTrue: [^ #breakpoint]].
 
  (self isSelectorOverride: aSymbol)
  ifTrue: [
  (self isSelectorOverridden: aSymbol)
  ifTrue: [ ^ #arrowUpAndDown ]
  ifFalse: [ ^ #arrowUp ] ]
  ifFalse: [
  (self isSelectorOverridden: aSymbol)
  ifTrue: [^ #arrowDown ]].
 
  self methodDictionary at: aSymbol ifPresent: [ :method |
  (method primitive ~= 0 and: [method isQuick not])
  ifTrue: [^ #primitive]].
 
 
  ^ #blank!

Item was changed:
  ----- Method: MessageSet>>filterToNotSendersOf (in category 'filtering') -----
  filterToNotSendersOf
  "Filter the receiver's list down to only those items which do not send a given selector"
 
  | aFragment inputWithBlanksTrimmed |
 
  aFragment := self request: 'type selector:' initialAnswer: ''.
  aFragment  isEmptyOrNil ifTrue: [^ self].
  inputWithBlanksTrimmed := aFragment withBlanksTrimmed.
  Symbol hasInterned: inputWithBlanksTrimmed ifTrue:
  [:aSymbol |
  self filterFrom:
  [:aClass :aSelector | | aMethod |
  (aMethod := aClass compiledMethodAt: aSelector) isNil or:
+ [(aMethod hasLiteral: aSymbol) not]]]!
- [(aMethod hasLiteralThorough: aSymbol) not]]]!

Item was changed:
  ----- Method: MessageSet>>filterToSendersOf (in category 'filtering') -----
  filterToSendersOf
  "Filter the receiver's list down to only those items which send a given selector"
 
  | aFragment inputWithBlanksTrimmed |
 
  aFragment := self request: 'type selector:' initialAnswer: ''.
  aFragment  isEmptyOrNil ifTrue: [^ self].
  inputWithBlanksTrimmed := aFragment withBlanksTrimmed.
  Symbol hasInterned: inputWithBlanksTrimmed ifTrue:
  [:aSymbol |
  self filterFrom:
  [:aClass :aSelector | | aMethod |
  (aMethod := aClass compiledMethodAt: aSelector) notNil and:
+ [aMethod hasLiteral: aSymbol]]]
- [aMethod hasLiteralThorough: aSymbol]]]
 
  !

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 := aCompiledMethod messages.
- SystemNavigation thoroughSenders ifTrue:
- [| litGetter |
- litGetter := [:l|
- (l isSymbol and: [l size > 0 and: [l first isLowercase]]) ifTrue:
- [messages add: l].
- l isArray ifTrue:
- [l do: litGetter]].
- aCompiledMethod allLiterals do: litGetter.
- aCompiledMethod pragmas do:
- [:pragma|
- litGetter
- value: pragma keyword;
- value: pragma arguments]].
  messages remove: selectorOrNil ifAbsent: ["do nothing"].
  messages ifEmpty: "If only one item, there is no choice"
  [^selectorOrNil ifNotNil: [aBlock value: selectorOrNil]].
  self systemNavigation
  showMenuOf: messages
  withFirstItem: selectorOrNil
  ifChosenDo: aBlock!