Skip to content

Commit

Permalink
allAccessesTo: instVarName from: aClass should delegate to slot with …
Browse files Browse the repository at this point in the history
…allMethodsAccessingSlot:

fixes pharo-project#3514
  • Loading branch information
MarcusDenker committed Jun 14, 2019
1 parent 930b73e commit 5f8ea08
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
6 changes: 2 additions & 4 deletions src/GT-SpotterExtensions-Core/Slot.extension.st
Expand Up @@ -8,10 +8,8 @@ Slot >> spotterAccessesFor: aStep [
aStep origin isKindOf: Class]]) ifTrue: [
aStep listProcessor
title: 'Accesses';
allCandidates: [
SystemNavigation default
allAccessesTo: self name
from: aStep previousStep origin ];
allCandidates: [
(aStep previousStep origin slotNamed: self name) usingMethods ];
itemName: [:each | each asString];
filter: GTFilterSubstring ]
]
9 changes: 4 additions & 5 deletions src/System-Support/SystemNavigation.class.st
Expand Up @@ -19,11 +19,10 @@ SystemNavigation class >> default [

{ #category : #query }
SystemNavigation >> allAccessesTo: instVarName from: aClass [
| coll |
coll := OrderedCollection new.
aClass
withAllSubAndSuperclassesDo: [ :class | (class whichSelectorsAccess: instVarName) do: [ :sel | coll add: (self createMethodNamed: sel realParent: class) ] ].
^ coll
| methods |
methods := aClass allMethodsAccessingSlot: (aClass slotNamed: instVarName).
^methods collect: [:meth | self createMethodNamed: meth selector realParent: meth methodClass]

]

{ #category : #query }
Expand Down
10 changes: 6 additions & 4 deletions src/Tool-Base/SystemNavigation.extension.st
Expand Up @@ -5,13 +5,15 @@ SystemNavigation >> browseAllAccessesTo: instVarName from: aClass [
"Create and schedule a Message Set browser for all the receiver's methods
or any methods of a subclass/superclass that refer to the instance variable name."

"self new browseAllAccessesTo: 'contents' from: Collection."
"self new browseAllAccessesTo: 'x' from: Point."

| coll slot |
coll := self allAccessesTo: instVarName from: aClass.
| methods slot |
slot := aClass slotNamed: instVarName.
methods := (aClass allMethodsAccessingSlot: slot)
collect: [:meth | self createMethodNamed: meth selector realParent: meth methodClass].

^ self
browseMessageList: coll
browseMessageList: methods
name: 'Accesses to ' , instVarName
autoSelect: instVarName
refreshingBlock: [ :method | slot isAccessedIn: method ]
Expand Down

0 comments on commit 5f8ea08

Please sign in to comment.