Skip to content
Permalink
Browse files

fixes #3619

#allCallsOn: on Behavior forwards to SystemNavigation, but that is not needed.

In addition, we can simplify

do not wrap, that is the job of the UI
do not sort, that is UI
use flatCollect:
  • Loading branch information
MarcusDenker committed Jun 25, 2019
1 parent 9c3e201 commit 2684e60b5bbbf0a9da0b2ebab555a02582bc708d
@@ -1,5 +1,11 @@
Extension { #name : #SystemNavigation }

{ #category : #'*Deprecated80' }
SystemNavigation >> allCallsOn: aSymbol from: aClass [
self deprecated: 'use #allCallsOn: of class directly'.
^aClass allCallsOn: aSymbol
]

{ #category : #'*Deprecated80' }
SystemNavigation >> allClassesUsingSharedPool: aString [
"Answer all classes that uses the shared pool named aString."
@@ -20,7 +20,7 @@ ClassQueryTest >> testAllCallsOnASymbol [

| set cm |
set := Object allCallsOn: #shallowCopy.
cm := (set detect: [ :rgMethod | (rgMethod selector == #copy) and: [rgMethod className = #Object]]) compiledMethod.
cm := (set detect: [ :rgMethod | (rgMethod selector == #copy) and: [rgMethod methodClass = Object]]).
self assert: (cm literals includes: #shallowCopy)
]

@@ -9,9 +9,10 @@ Behavior >> allCallsOn [

{ #category : #'*System-Support' }
Behavior >> allCallsOn: aSymbol [
"Answer a SortedCollection of all the methods that call on aSymbol."
"Answer of all the methods that call on aSymbol."

^ self systemNavigation allCallsOn: aSymbol from: self .
^self withAllSubclasses flatCollect: [ :cls |
(cls whichSelectorsReferTo: aSymbol) collect: [:sel | cls>>sel]]

]

@@ -45,18 +45,6 @@ SystemNavigation >> allCallsOn: aSymbol [
^ self allReferencesTo: aSymbol
]

{ #category : #query }
SystemNavigation >> allCallsOn: aSymbol from: aClass [
"Answer a SortedCollection of all the methods that call on aSymbol."

| collection |
collection := OrderedCollection new.
aClass withAllSubclassesDo: [ :class |
(class whichSelectorsReferTo: aSymbol) do: [:sel |
collection add: (class>>sel) methodReference]].
^collection
]

{ #category : #query }
SystemNavigation >> allClasses [
"Returns all the classes in the current environment."

0 comments on commit 2684e60

Please sign in to comment.
You can’t perform that action at this time.