Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change at: for classNamed: as ask in PR #3254 #3395

Merged
merged 2 commits into from
May 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Refactoring-Changes/RBAddClassChange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ RBAddClassChange class >> definitionPatterns [
RBAddClassChange >> asUndoOperation [
| class |
class := onSystemDictionary
at: self changeClassName
ifAbsent: [ nil ].
classNamed: self changeClassName.

^ class isBehavior
ifTrue: [ changeFactory addClassDefinition: class definition ]
ifFalse: [ changeFactory removeClassNamed: self changeClassName ]
Expand All @@ -54,7 +54,7 @@ RBAddClassChange >> classVariableNames [

{ #category : #private }
RBAddClassChange >> definitionClass [
^ onSystemDictionary at: (self superclassName ifNil: [ ^ ProtoObject ])
^ onSystemDictionary classNamed: (self superclassName ifNil: [ #ProtoObject ])
]

{ #category : #private }
Expand Down
6 changes: 3 additions & 3 deletions src/Refactoring-Changes/RBAddMethodChange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ RBAddMethodChange >> hash [
RBAddMethodChange >> oldVersionTextToDisplay [
| class |

class := onSystemDictionary
at: className asSymbol
ifAbsent: [ ^ super oldVersionTextToDisplay ].
class := (onSystemDictionary
classNamed: className)
ifNil: [ ^ super oldVersionTextToDisplay ].

isMeta ifTrue: [ class := class classSide ].

Expand Down
4 changes: 1 addition & 3 deletions src/Refactoring-Changes/RBAddTraitChange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ RBAddTraitChange class >> definitionPatterns [
{ #category : #converting }
RBAddTraitChange >> asUndoOperation [
| trait |
trait := onSystemDictionary
at: self changeClassName
ifAbsent: [ nil ].
trait := onSystemDictionary classOrTraitNamed: self changeClassName.
^ trait isTrait
ifTrue: [ changeFactory addTraitDefinition: trait definition ]
ifFalse: [ changeFactory removeClassNamed: self changeClassName ]
Expand Down
10 changes: 10 additions & 0 deletions src/Refactoring-Changes/RBRefactoryChange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ RBRefactoryChange >> oldVersionTextToDisplay [
^ ''
]

{ #category : #accessing }
RBRefactoryChange >> onSystemDictionary [
^ onSystemDictionary
]

{ #category : #accessing }
RBRefactoryChange >> onSystemDictionary: anObject [
onSystemDictionary := anObject
]

{ #category : #accessing }
RBRefactoryChange >> renameChangesForClass: oldClassName to: newClassName [
"We're in the middle of performing a rename operation. If we stored the class name, we need to change the class name to the new name to perform the compiles."
Expand Down
2 changes: 1 addition & 1 deletion src/Refactoring-Changes/RBRenameClassChange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RBRenameClassChange >> = aRenameClassChange [

{ #category : #accessing }
RBRenameClassChange >> changeClass [
^ onSystemDictionary at: oldName asSymbol ifAbsent: [ onSystemDictionary at: newName asSymbol ]
^ (onSystemDictionary classNamed: oldName) ifNil: [ onSystemDictionary classNamed: newName ]
]

{ #category : #private }
Expand Down
2 changes: 1 addition & 1 deletion src/Refactoring-Changes/RBRenameVariableChange.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RBRenameVariableChange >> addNewVariable [
{ #category : #accessing }
RBRenameVariableChange >> changeClass [
| class |
class := Smalltalk globals at: self changeClassName ifAbsent: [ ^ nil ].
class := onSystemDictionary classNamed: self changeClassName.
^ isMeta ifTrue: [ class class ] ifFalse: [ class ]
]

Expand Down