Skip to content

Commit

Permalink
Improve message in preconditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lin777 committed Feb 22, 2021
1 parent 690d71d commit 0c4bf7d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ RBTemporaryToInstanceVariableRefactoring >> class: aClass selector: aSelector va
RBTemporaryToInstanceVariableRefactoring >> preconditions [
^(RBCondition definesSelector: selector in: class)
& (RBCondition definesInstanceVariable: temporaryVariableName asString in: class) not
& (RBCondition withBlock: [
(class allSubclasses anySatisfy:
[ :cls | cls definesInstanceVariable: temporaryVariableName asString ])
ifTrue: [ self refactoringWarning:
('One or more subclasses of <1p> already defines an<n>instance variable with the same name. Proceed anyway?' expandMacrosWith: class name) ].
true ])
& (RBCondition withBlock:
[self checkForValidTemporaryVariable.
true])
Expand Down

0 comments on commit 0c4bf7d

Please sign in to comment.