Skip to content

Commit

Permalink
[improvement] another rename to better reflect AST visiion.
Browse files Browse the repository at this point in the history
  • Loading branch information
hogoww committed Apr 18, 2020
1 parent 3f0061d commit f8c9d73
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Extension { #name : #SycRenameTempCommand }
Extension { #name : #SycRenameArgOrTempCommand }

{ #category : #'*Calypso-SystemTools-Core' }
SycRenameTempCommand classSide >> sourceCodeMenuActivation [
SycRenameArgOrTempCommand class >> sourceCodeMenuActivation [
<classAnnotation>

^SycSourceCodeMenuActivation byRootGroupItemOrder: 1.2 for: ClyMethodSourceCodeContext
]

{ #category : #'*Calypso-SystemTools-Core' }
SycRenameTempCommand classSide >> sourceCodeShortcutActivation [
SycRenameArgOrTempCommand class >> sourceCodeShortcutActivation [
<classAnnotation>

^CmdShortcutActivation renamingFor: ClyMethodSourceCodeContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ReTemporaryVariableCapitalizationRule >> critiqueFor: aNode [
crit
tinyHint: aNode name;
refactoring: (
RBRenameTemporaryRefactoring
RBRenameArgumentOrTemporaryRefactoring
renameTemporaryFrom: aNode sourceInterval
to: aNode name uncapitalized
in: aNode methodNode methodClass
Expand Down
2 changes: 1 addition & 1 deletion src/NautilusRefactoring/NautilusRefactoring.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ NautilusRefactoring >> privateRenameMethodFor: aMethod withNewName: newMethodNam
{ #category : #'private-source' }
NautilusRefactoring >> privateRenameTemporaryNamed: oldname Between: anInterval from: aMethod [

^ RBRenameTemporaryRefactoring
^ RBRenameArgumentOrTemporaryRefactoring
model: environment
renameTemporaryFrom: anInterval
to: (self request: self newVariableRequestText initialAnswer: oldname)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The variable declaration an all references in this method are renamed.
My precondition verify that the new name is a valid variable name and not an existing instance or a class variable name
"
Class {
#name : #RBRenameTemporaryRefactoring,
#name : #RBRenameArgumentOrTemporaryRefactoring,
#superclass : #RBMethodRefactoring,
#instVars : [
'selector',
Expand All @@ -20,7 +20,7 @@ Class {
}

{ #category : #'instance creation' }
RBRenameTemporaryRefactoring class >> model: aRBSmalltalk renameTemporaryFrom: anInterval to: newName in: aClass selector: aSelector [
RBRenameArgumentOrTemporaryRefactoring class >> model: aRBSmalltalk renameTemporaryFrom: anInterval to: newName in: aClass selector: aSelector [
^(self new)
model: aRBSmalltalk;
class: aClass
Expand All @@ -31,7 +31,7 @@ RBRenameTemporaryRefactoring class >> model: aRBSmalltalk renameTemporaryFrom: a
]

{ #category : #'instance creation' }
RBRenameTemporaryRefactoring class >> renameTemporaryFrom: anInterval to: newName in: aClass selector: aSelector [
RBRenameArgumentOrTemporaryRefactoring class >> renameTemporaryFrom: anInterval to: newName in: aClass selector: aSelector [
^self new
class: aClass
selector: aSelector
Expand All @@ -40,15 +40,15 @@ RBRenameTemporaryRefactoring class >> renameTemporaryFrom: anInterval to: newNam
]

{ #category : #initialization }
RBRenameTemporaryRefactoring >> class: aClass selector: aSelector interval: anInterval newName: aString [
RBRenameArgumentOrTemporaryRefactoring >> class: aClass selector: aSelector interval: anInterval newName: aString [
class := self classObjectFor: aClass.
selector := aSelector.
interval := anInterval.
newName := aString
]

{ #category : #preconditions }
RBRenameTemporaryRefactoring >> preconditions [
RBRenameArgumentOrTemporaryRefactoring >> preconditions [
^ (RBCondition
withBlock: [ | methodSource |
interval first > interval last
Expand All @@ -62,7 +62,7 @@ RBRenameTemporaryRefactoring >> preconditions [
]

{ #category : #tranforming }
RBRenameTemporaryRefactoring >> renameNode: aParseTree [
RBRenameArgumentOrTemporaryRefactoring >> renameNode: aParseTree [
(aParseTree whoDefines: newName)
ifNotNil: [ self refactoringError: newName asString , ' is already defined' ].
(aParseTree allDefinedVariables includes: newName)
Expand All @@ -71,7 +71,7 @@ RBRenameTemporaryRefactoring >> renameNode: aParseTree [
]

{ #category : #printing }
RBRenameTemporaryRefactoring >> storeOn: aStream [
RBRenameArgumentOrTemporaryRefactoring >> storeOn: aStream [
aStream nextPut: $(.
self class storeOn: aStream.
aStream nextPutAll: ' renameTemporaryFrom: '.
Expand All @@ -88,7 +88,7 @@ RBRenameTemporaryRefactoring >> storeOn: aStream [
]

{ #category : #tranforming }
RBRenameTemporaryRefactoring >> transform [
RBRenameArgumentOrTemporaryRefactoring >> transform [
| definingNode variableNode |
parseTree := class parseTreeFor: selector.
variableNode := self whichVariableNode: parseTree inInterval: interval name: oldName.
Expand Down

0 comments on commit f8c9d73

Please sign in to comment.