Skip to content

Commit

Permalink
Fixing protocol names
Browse files Browse the repository at this point in the history
  • Loading branch information
carolahp committed Mar 25, 2022
1 parent 1199a0a commit 4bebe4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
13 changes: 2 additions & 11 deletions src/Refactoring-Core/RBReplaceMethodRefactoring.class.st
Expand Up @@ -117,7 +117,7 @@ RBReplaceMethodRefactoring >> parseTreeRewriter [
^rewriteRule
]

{ #category : #transforming }
{ #category : #preconditions }
RBReplaceMethodRefactoring >> preconditions [
|conditions|

Expand All @@ -127,16 +127,7 @@ RBReplaceMethodRefactoring >> preconditions [
&(RBCondition definesSelector: oldSelector in: class )
& (RBCondition definesSelector: newSelector in: class ).

^ conditions & (RBCondition withBlock:
[ |senders|
senders := self replaceInAllClasses
ifTrue: [ self model allReferencesTo: oldSelector ]
ifFalse: [ self model allReferencesTo: oldSelector in: {class} ].
senders size > 1
ifTrue:
[self refactoringWarning: ('This will modify all <1p> senders.<n>Proceed anyway?'
expandMacrosWith: senders size)].
true])
^ conditions
]

{ #category : #initialization }
Expand Down
Expand Up @@ -82,7 +82,7 @@ RBChangeMethodNameTransformation >> parseTreeRewriter [
^rewriteRule
]

{ #category : #support }
{ #category : #preconditions }
RBChangeMethodNameTransformation >> preconditions [
"This refactoring only preserves behavior if all implementors are renamed."

Expand All @@ -95,12 +95,7 @@ RBChangeMethodNameTransformation >> preconditions [
inject: conditions into: [ :condition :each |
condition & (RBCondition hierarchyOf: each canUnderstand: newSelector) not ].

^conditions & (RBCondition withBlock:
[self implementors size > 1
ifTrue:
[self refactoringWarning: ('This will modify all <1p> implementors. Proceed anyway?'
expandMacrosWith: self implementors size)].
true])
^conditions
]

{ #category : #support }
Expand Down

0 comments on commit 4bebe4e

Please sign in to comment.