├── .gitattributes ├── .gitignore ├── __Refactoring-TestData__.pck.st ├── README.md └── ExtraRefactoringsLiveTyping.pck.st /.gitattributes: -------------------------------------------------------------------------------- 1 | *.st -text linguist-language=Smalltalk 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | CoreUpdates 2 | *.changes 3 | *.image 4 | *.sources 5 | Packages 6 | -------------------------------------------------------------------------------- /__Refactoring-TestData__.pck.st: -------------------------------------------------------------------------------- 1 | 'From Cuis 5.0 of 7 November 2016 [latest update: #3562] on 7 January 2019 at 10:48:57 pm'! 2 | 'Description This package is to keep all changes during the executions of the refactoring tests in one place'! 3 | !provides: '__Refactoring-TestData__' 1 1! 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cuis-Smalltalk-Refactoring 2 | All the refactorings that used to be in this package are now part of the Cuis image. 3 | The refactorings left in this package are: 4 | - Extract Class 5 | - Move Instance Variable 6 | - Move Method 7 | - Extract Parameter Object 8 | - Extract to Method Object 9 | - Introduce Null Object 10 | -------------------------------------------------------------------------------- /ExtraRefactoringsLiveTyping.pck.st: -------------------------------------------------------------------------------- 1 | 'From Cuis7.3 [latest update: #7146] on 14 May 2025 at 11:58:13 am'! 2 | 'Description fix sent unimplemented messages'! 3 | !provides: 'ExtraRefactoringsLiveTyping' 1 2! 4 | !requires: 'ExtraRefactorings' 1 0 nil! 5 | !requires: 'LiveTyping' 1 128 nil! 6 | SystemOrganization addCategory: #'ExtraRefactoringsLiveTyping-ExtractParameterObject-Model'! 7 | SystemOrganization addCategory: #'ExtraRefactoringsLiveTyping-ExtractParameterObject-UI'! 8 | SystemOrganization addCategory: #'ExtraRefactoringsLiveTyping-MoveInstanceVariable-UI'! 9 | SystemOrganization addCategory: #'ExtraRefactoringsLiveTyping-MoveMethod-UI'! 10 | 11 | 12 | !classDefinition: #ExtractParameterObjectWithActualScope category: #'ExtraRefactoringsLiveTyping-ExtractParameterObject-Model'! 13 | ExtractParameterObject subclass: #ExtractParameterObjectWithActualScope 14 | instanceVariableNames: 'shouldChangePossibleMessageSends' 15 | classVariableNames: '' 16 | poolDictionaries: '' 17 | category: 'ExtraRefactoringsLiveTyping-ExtractParameterObject-Model'! 18 | !classDefinition: 'ExtractParameterObjectWithActualScope class' category: #'ExtraRefactoringsLiveTyping-ExtractParameterObject-Model'! 19 | ExtractParameterObjectWithActualScope class 20 | instanceVariableNames: ''! 21 | 22 | !classDefinition: #ExtractParameterObjectWithActualScopeApplier category: #'ExtraRefactoringsLiveTyping-ExtractParameterObject-UI'! 23 | ExtractParameterObjectApplier subclass: #ExtractParameterObjectWithActualScopeApplier 24 | instanceVariableNames: '' 25 | classVariableNames: '' 26 | poolDictionaries: '' 27 | category: 'ExtraRefactoringsLiveTyping-ExtractParameterObject-UI'! 28 | !classDefinition: 'ExtractParameterObjectWithActualScopeApplier class' category: #'ExtraRefactoringsLiveTyping-ExtractParameterObject-UI'! 29 | ExtractParameterObjectWithActualScopeApplier class 30 | instanceVariableNames: ''! 31 | 32 | !classDefinition: #MoveInstanceVariableWithActualScopeApplier category: #'ExtraRefactoringsLiveTyping-MoveInstanceVariable-UI'! 33 | MoveInstanceVariableApplier subclass: #MoveInstanceVariableWithActualScopeApplier 34 | instanceVariableNames: '' 35 | classVariableNames: '' 36 | poolDictionaries: '' 37 | category: 'ExtraRefactoringsLiveTyping-MoveInstanceVariable-UI'! 38 | !classDefinition: 'MoveInstanceVariableWithActualScopeApplier class' category: #'ExtraRefactoringsLiveTyping-MoveInstanceVariable-UI'! 39 | MoveInstanceVariableWithActualScopeApplier class 40 | instanceVariableNames: ''! 41 | 42 | !classDefinition: #MoveMethodWithActualScopeApplier category: #'ExtraRefactoringsLiveTyping-MoveMethod-UI'! 43 | MoveMethodApplier subclass: #MoveMethodWithActualScopeApplier 44 | instanceVariableNames: '' 45 | classVariableNames: '' 46 | poolDictionaries: '' 47 | category: 'ExtraRefactoringsLiveTyping-MoveMethod-UI'! 48 | !classDefinition: 'MoveMethodWithActualScopeApplier class' category: #'ExtraRefactoringsLiveTyping-MoveMethod-UI'! 49 | MoveMethodWithActualScopeApplier class 50 | instanceVariableNames: ''! 51 | 52 | 53 | !ExtractParameterObjectWithActualScope methodsFor: 'as yet unclassified' stamp: 'HAW 3/25/2025 11:56:56'! 54 | createAddParameterRefactoring 55 | 56 | ^ AddParameterWithActualScope 57 | named: parameterObjectName 58 | at: method numArgs + 1 59 | initializedWith: parameterObjectPlaceHolder 60 | using: self parameterObjectKeyword 61 | toKeywordSelector: method selector 62 | implementors: newImplementors 63 | senders: newSenders 64 | withPossibleMessageSends: shouldChangePossibleMessageSends! ! 65 | 66 | !ExtractParameterObjectWithActualScope methodsFor: 'as yet unclassified' stamp: 'HAW 3/25/2025 11:56:45'! 67 | createRemoveParameterRefactoringFor: aParameter at: anIndex 68 | 69 | ^ RemoveParameterWithActualScope 70 | atIndex: anIndex 71 | named: aParameter 72 | from: method 73 | implementors: newImplementors 74 | senders: newSenders 75 | withPossibleMessageSends: shouldChangePossibleMessageSends 76 | ! ! 77 | 78 | !ExtractParameterObjectWithActualScopeApplier methodsFor: 'refactoring - parameters request' stamp: 'MEGL 5/17/2024 11:19:52'! 79 | actualScopeOptionLabels 80 | 81 | ^{ 'Actual Scope' }! ! 82 | 83 | !ExtractParameterObjectWithActualScopeApplier methodsFor: 'refactoring - parameters request' stamp: 'HAW 5/13/2025 16:43:30'! 84 | calculateImplementorsAndSenders 85 | 86 | self isActualScopeChoice 87 | ifTrue: [ self actualImplementorsAndSenders ] 88 | ifFalse: [ super calculateImplementorsAndSenders ] 89 | ! ! 90 | 91 | !ExtractParameterObjectWithActualScopeApplier methodsFor: 'refactoring - parameters request' stamp: 'MEGL 11/25/2024 20:44:07'! 92 | convertSendersToCompiledMethods 93 | 94 | self filterSenders! ! 95 | 96 | !ExtractParameterObjectWithActualScopeApplier methodsFor: 'refactoring - parameters request' stamp: 'MEGL 11/25/2024 20:04:19'! 97 | messageNode 98 | 99 | ^nil! ! 100 | 101 | !ExtractParameterObjectWithActualScopeApplier methodsFor: 'refactoring - parameters request' stamp: 'MEGL 5/17/2024 11:24:47'! 102 | scopeOptionLabels 103 | 104 | ^super scopeOptionLabels, self actualScopeOptionLabels! ! 105 | 106 | !ExtractParameterObjectWithActualScopeApplier class methodsFor: 'as yet unclassified' stamp: 'HAW 4/28/2025 18:07:37'! 107 | initialize 108 | 109 | RefactoringApplier registerExtractParameterObjectApplier: self! ! 110 | 111 | !MoveInstanceVariableWithActualScopeApplier methodsFor: 'refactoring - parameters request' stamp: 'mc 6/17/2024 15:53:03'! 112 | initialAnswerForInstanceVariable: anAccessingThroughinstanceVariableName in: aSourceClass 113 | 114 | | liveTypingTypes | 115 | classToRefactor shouldLiveTypingBeDisabled ifTrue: [^'']. 116 | accessingThroughinstanceVariableName ifNil: [^'']. 117 | liveTypingTypes := classToRefactor commonSupertypeOfInstanceVariableNamed: accessingThroughinstanceVariableName ifNoTypes: [^'']. 118 | ^liveTypingTypes name asString ! ! 119 | 120 | !MoveInstanceVariableWithActualScopeApplier class methodsFor: 'as yet unclassified' stamp: 'HAW 4/28/2025 18:07:50'! 121 | initialize 122 | 123 | RefactoringApplier registerMoveInstanceVariableApplier: self ! ! 124 | 125 | !MoveMethodWithActualScopeApplier methodsFor: 'refactoring - parameters request' stamp: 'HAW 4/28/2025 16:51:51'! 126 | initialAnswerForInstanceVariable: anAccessingThroughVariableName in: aSourceClass 127 | 128 | | liveTypingTypes | 129 | 130 | anAccessingThroughVariableName = 'ToClassGlobalObject' ifTrue: [ ^'' ]. 131 | sourceClass shouldLiveTypingBeDisabled ifTrue: [^'']. 132 | accessingThroughVariableName ifNil: [^'']. 133 | (methodReference methodNode argumentNames includes: accessingThroughVariableName) ifTrue: [^((sourceClass>>methodToMove typeInfoOfVariableNamed: accessingThroughVariableName ifAbsent: [^'']) commonSupertypeIfNoTypes: [^'']) name asString]. 134 | liveTypingTypes := sourceClass commonSupertypeOfInstanceVariableNamed: accessingThroughVariableName ifNoTypes: [^'']. 135 | 136 | ^liveTypingTypes name asString 137 | ! ! 138 | 139 | !MoveMethodWithActualScopeApplier class methodsFor: 'instance creation' stamp: 'HAW 4/28/2025 18:08:13'! 140 | initialize 141 | 142 | RefactoringApplier registerMoveMethodApplier: self! ! 143 | 144 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'MEGL 11/11/2024 11:20:47'! 145 | extractParameterObjectApplier 146 | 147 | ^self applierAt: self extractParameterObjectApplierId ifAbsent: [ ExtractParameterObjectApplier ]! ! 148 | 149 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'MEGL 11/11/2024 11:20:31'! 150 | extractParameterObjectApplierId 151 | 152 | ^#extractParameterObjectApplier! ! 153 | 154 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'mc 12/11/2023 01:54:26'! 155 | moveInstanceVariableApplier 156 | "self halt." 157 | ^self applierAt: self moveInstanceVariableApplierId ifAbsent: [ MoveInstanceVariableApplier ]! ! 158 | 159 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'mc 12/11/2023 01:55:07'! 160 | moveInstanceVariableApplierId 161 | 162 | ^#moveInstanceVariableApplier! ! 163 | 164 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'HAW 4/28/2025 16:36:34'! 165 | moveMethodApplier 166 | 167 | ^self applierAt: self moveMethodApplierId ifAbsent: [ MoveMethodApplier ]! ! 168 | 169 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'mc 8/6/2023 15:07:01'! 170 | moveMethodApplierId 171 | ^#moveMethodApplier! ! 172 | 173 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'MEGL 11/11/2024 11:21:06'! 174 | registerExtractParameterObjectApplier: aExtractParameterObjectApplierClass 175 | 176 | self registerApplierAt: self extractParameterObjectApplierId with: aExtractParameterObjectApplierClass! ! 177 | 178 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'mc 12/11/2023 01:57:01'! 179 | registerMoveInstanceVariableApplier: aMoveInstanceVariableApplierClass 180 | 181 | self registerApplierAt: self moveInstanceVariableApplierId with: aMoveInstanceVariableApplierClass! ! 182 | 183 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'mc 8/6/2023 15:13:19'! 184 | registerMoveMethodApplier: aMoveMethodApplierClass 185 | 186 | self registerApplierAt: self moveMethodApplierId with: aMoveMethodApplierClass 187 | ! ! 188 | 189 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'MEGL 11/11/2024 11:21:12'! 190 | resetExtractParameterObjectApplier 191 | 192 | self resetApplierAt: self extractParameterObjectApplierId! ! 193 | 194 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'HAW 4/28/2025 16:38:42'! 195 | resetMoveInstanceVariableApplier 196 | 197 | self resetApplierAt: self moveInstanceVariableApplierId ! ! 198 | 199 | !RefactoringApplier class methodsFor: '*ExtraRefactoringsLiveTyping' stamp: 'HAW 4/28/2025 16:38:57'! 200 | resetMoveMethodApplier 201 | 202 | self resetApplierAt: self moveMethodApplierId ! ! 203 | ExtractParameterObjectWithActualScopeApplier initialize! 204 | MoveInstanceVariableWithActualScopeApplier initialize! 205 | MoveMethodWithActualScopeApplier initialize! 206 | --------------------------------------------------------------------------------