Skip to content

Commit

Permalink
Refactor: deprecate whoDefinesMethod: with `whichClassIncludesSelec…
Browse files Browse the repository at this point in the history
…tor:`
  • Loading branch information
balsa-sarenac committed Apr 26, 2024
1 parent dbfe079 commit 09ee00f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 50 deletions.
43 changes: 0 additions & 43 deletions src/Refactoring-Core-Tests/RBClassTest.class.st
Expand Up @@ -269,46 +269,3 @@ RBClassTest >> testWhichSelectorsReferToClassVariable [
self assert: (sub classSide whichSelectorsReferToSharedVariable: #Shared2) isNotEmpty.

]

{ #category : 'tests - defining methods' }
RBClassTest >> testWhoDefinesMethodDefinedInTheClass [

self
assert: (objectClass whoDefinesMethod: #'~~>')
equals: objectClass
]

{ #category : 'tests - defining methods' }
RBClassTest >> testWhoDefinesMethodDoesNotExist [

self
assert: (abstractTransformationClass whoDefinesMethod: #doesNotExistAtAll)
equals: nil
]

{ #category : 'tests - defining methods' }
RBClassTest >> testWhoDefinesMethodGoingUp [

self
assert:
((rbNamespace classNamed: #Model) whoDefinesMethod: #'~~>')
equals: objectClass
]

{ #category : 'tests - defining methods' }
RBClassTest >> testWhoDefinesMethodGoingUpAndDoNotFind [

self
assert:
((rbNamespace classNamed: #Model) whoDefinesMethod:
#doesNotExistAtAll)
equals: nil
]

{ #category : 'tests - defining methods' }
RBClassTest >> testWhoDefinesMethodSelectorDoNotFind [

self
assert: (abstractTransformationClass whoDefinesMethod: #doesNotExistAtAll)
equals: nil
]
14 changes: 7 additions & 7 deletions src/Refactoring-Core/RBAbstractClass.class.st
Expand Up @@ -815,9 +815,8 @@ RBAbstractClass >> typeOfClassVariable: aSymbol [
RBAbstractClass >> whichClassIncludesSelector: aSelector [

(self directlyDefinesMethod: aSelector) ifTrue: [ ^ self ].
^ self superclass isNil
ifFalse: [ self superclass whichClassIncludesSelector: aSelector ]
ifTrue: [ nil ]
^ self superclass ifNotNil: [
self superclass whichClassIncludesSelector: aSelector ]
]

{ #category : 'method accessing' }
Expand Down Expand Up @@ -957,10 +956,11 @@ RBAbstractClass >> whoDefinesInstanceVariable: aString [

{ #category : 'method accessing' }
RBAbstractClass >> whoDefinesMethod: aSelector [
| sprClass |
(self directlyDefinesMethod: aSelector) ifTrue: [ ^ self ].
sprClass := self superclass.
^ sprClass ifNotNil: [ sprClass whoDefinesMethod: aSelector ]

self
deprecated: 'Use whichClassIncludesSelector: instead of current one'
transformWith: '`@rec whoDefinesMethod: `@arg' -> '`@rec whichClassIncludesSelector: `@arg'.
^ self whichClassIncludesSelector: aSelector
]

{ #category : 'accessing' }
Expand Down

0 comments on commit 09ee00f

Please sign in to comment.