-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14940 from Ducasse/2023-10-09-CleanRemoveShared
- Continue to migrate RBCondition to RBNewAbstractCondition subclasses
- Loading branch information
Showing
9 changed files
with
140 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Class { | ||
#name : 'RBClassCondition', | ||
#superclass : 'RBClassNameCondition', | ||
#instVars : [ | ||
'aClass' | ||
], | ||
#category : 'Refactoring-Core-Conditions', | ||
#package : 'Refactoring-Core', | ||
#tag : 'Conditions' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
RBClassCondition class >> class: anRBClass [ | ||
^ self new | ||
class: anRBClass; | ||
yourself | ||
] | ||
|
||
{ #category : 'accessing' } | ||
RBClassCondition >> class: aRBClass [ | ||
aClass := aRBClass | ||
] | ||
|
||
{ #category : 'accessing' } | ||
RBClassCondition >> classNamed: aString [ | ||
aClass := model classNamed: aString | ||
] | ||
|
||
{ #category : 'accessing' } | ||
RBClassCondition >> model: aModel [ | ||
model := aModel | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Class { | ||
#name : 'RBClassNameCondition', | ||
#superclass : 'RBNewAbstractCondition', | ||
#instVars : [ | ||
'violators', | ||
'model', | ||
'className' | ||
], | ||
#category : 'Refactoring-Core-Conditions', | ||
#package : 'Refactoring-Core', | ||
#tag : 'Conditions' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
RBClassNameCondition class >> classNamed: aString inModel: aModel [ | ||
|
||
^ self new | ||
model: aModel; | ||
classNamed: aString; | ||
yourself | ||
] | ||
|
||
{ #category : 'accessing' } | ||
RBClassNameCondition >> classNamed: aString [ | ||
className := aString | ||
] | ||
|
||
{ #category : 'accessing' } | ||
RBClassNameCondition >> model: aModel [ | ||
model := aModel | ||
] |
35 changes: 35 additions & 0 deletions
35
src/Refactoring-Core/RBDefinesSharedVariableCondition.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Class { | ||
#name : 'RBDefinesSharedVariableCondition', | ||
#superclass : 'RBClassCondition', | ||
#instVars : [ | ||
'sharedVariables' | ||
], | ||
#category : 'Refactoring-Core-Conditions', | ||
#package : 'Refactoring-Core', | ||
#tag : 'Conditions' | ||
} | ||
|
||
{ #category : 'instance creation' } | ||
RBDefinesSharedVariableCondition class >> class: aRBClass sharedVariables: aCollection [ | ||
^ self new class: aRBClass; sharedVariables: aCollection ; yourself | ||
] | ||
|
||
{ #category : 'instance creation' } | ||
RBDefinesSharedVariableCondition class >> classNamed: aString inModel: aRBNamespace sharedVariables: aCollection [ | ||
|
||
^ (self classNamed: aString inModel: aRBNamespace) | ||
sharedVariables: aCollection; | ||
yourself | ||
] | ||
|
||
{ #category : 'accessing' } | ||
RBDefinesSharedVariableCondition >> check [ | ||
|
||
violators := sharedVariables reject: [ :shared | aClass definesClassVariable: shared ]. | ||
^ violators isEmpty | ||
] | ||
|
||
{ #category : 'accessing' } | ||
RBDefinesSharedVariableCondition >> sharedVariables: aCollection [ | ||
sharedVariables := aCollection | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Class { | ||
#name : 'RBIsClassDefined', | ||
#superclass : 'RBClassNameCondition', | ||
#category : 'Refactoring-Core-Conditions', | ||
#package : 'Refactoring-Core', | ||
#tag : 'Conditions' | ||
} | ||
|
||
{ #category : 'checking' } | ||
RBIsClassDefined >> check [ | ||
|
||
^ (model classNamed: className) isNotNil | ||
] | ||
|
||
{ #category : 'accessing' } | ||
RBIsClassDefined >> violators [ | ||
|
||
^ { className } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Class { | ||
#name : 'RBIsNotAMetaclass', | ||
#superclass : 'RBClassCondition', | ||
#category : 'Refactoring-Core-Conditions', | ||
#package : 'Refactoring-Core', | ||
#tag : 'Conditions' | ||
} | ||
|
||
{ #category : 'checking' } | ||
RBIsNotAMetaclass >> check [ | ||
^ aClass isMeta not | ||
] | ||
|
||
{ #category : 'checking' } | ||
RBIsNotAMetaclass >> violators [ | ||
^ { aClass } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
src/Refactoring-Core/RBRemoveSharedVariableRefactoring2.class.st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters