Skip to content

Commit

Permalink
Method category cleanup - pass 2
Browse files Browse the repository at this point in the history
fix #9384
  • Loading branch information
astares committed Jun 2, 2021
1 parent a22a97c commit 1de4954
Show file tree
Hide file tree
Showing 65 changed files with 321 additions and 400 deletions.
26 changes: 13 additions & 13 deletions src/AST-Core-Tests/RBMessageNodeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Class {
#category : #'AST-Core-Tests-Nodes'
}

{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testArgumentPartsForBinaryMessages [
| tree message |
tree := self parseMethod: 'test 1 + 2 '.
Expand All @@ -14,7 +14,7 @@ RBMessageNodeTest >> testArgumentPartsForBinaryMessages [

]

{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testArgumentPartsForKeywordMessages [
| tree message |
tree := self parseMethod: 'test self between: x + 2 and: (y foo: 3)'.
Expand All @@ -24,7 +24,7 @@ RBMessageNodeTest >> testArgumentPartsForKeywordMessages [
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testArgumentPartsForKeywordMessages1 [
| tree message |
tree := self parseMethod: 'test self between: 2 and: 3'.
Expand All @@ -34,7 +34,7 @@ RBMessageNodeTest >> testArgumentPartsForKeywordMessages1 [
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testArgumentPartsForKeywordMessages2 [
| tree message |
Expand All @@ -47,7 +47,7 @@ RBMessageNodeTest >> testArgumentPartsForKeywordMessages2 [
self assert: message argumentPartStrings asArray equals: #('x' 'y' 'zzz')
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testArgumentPartsForUnaryMessages [
| tree message |
tree := self parseMethod: 'test 1 foo '.
Expand All @@ -57,7 +57,7 @@ RBMessageNodeTest >> testArgumentPartsForUnaryMessages [
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testSelectorAndArgumentNamesForComposedKeywords [
| tree message |
tree := self parseMethod: 'test self between: x and: y'.
Expand All @@ -69,7 +69,7 @@ RBMessageNodeTest >> testSelectorAndArgumentNamesForComposedKeywords [
self assert: message selectorAndArgumentNames equals: 'between: x and: y and: zzz'
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testSelectorAndArgumentNamesForComposedKeywordsAndComplexArgs [
| tree message |
tree := self parseMethod: 'test self between: x + 2 and: (y foo: 3)'.
Expand All @@ -79,7 +79,7 @@ RBMessageNodeTest >> testSelectorAndArgumentNamesForComposedKeywordsAndComplexAr
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testSelectorAndArgumentNamesForSimpleKeywords [
| tree message |
tree := self parseMethod: 'test self doit: 5'.
Expand All @@ -89,7 +89,7 @@ RBMessageNodeTest >> testSelectorAndArgumentNamesForSimpleKeywords [
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testSelectorAndArgumentNamesForUnary [
| tree message |
tree := self parseMethod: 'test self doit'.
Expand All @@ -99,7 +99,7 @@ RBMessageNodeTest >> testSelectorAndArgumentNamesForUnary [
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testSelectorInterval [
| tree message |
tree := self parseMethod: 'test self doit'.
Expand All @@ -110,7 +110,7 @@ RBMessageNodeTest >> testSelectorInterval [
self assert: message selectorInterval equals: (11 to: 27).
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testSelectorPartsForBinaryMessages [
| tree message |
tree := self parseMethod: 'test 1 + 2 '.
Expand All @@ -120,7 +120,7 @@ RBMessageNodeTest >> testSelectorPartsForBinaryMessages [
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testSelectorPartsForKeywordMessages [
| tree message |
tree := self parseMethod: 'test self doit: 5'.
Expand All @@ -133,7 +133,7 @@ RBMessageNodeTest >> testSelectorPartsForKeywordMessages [
]
{ #category : #testing }
{ #category : #tests }
RBMessageNodeTest >> testSelectorPartsForUnaryMessages [
| tree message |
tree := self parseMethod: 'test self doit'.
Expand Down
2 changes: 1 addition & 1 deletion src/AST-Core/RBEnglobingErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Class {
#category : #'AST-Core-Nodes - ErrorNodes'
}

{ #category : #'as yet unclassified' }
{ #category : #'instance creation' }
RBEnglobingErrorNode class >> content: aCollection start: aStart stop: aStop errorMessage: message [
^self new
content: aCollection;
Expand Down
2 changes: 1 addition & 1 deletion src/AST-Core/RBInvalidCascadeErrorNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Class {
#category : #'AST-Core-Nodes - ErrorNodes'
}

{ #category : #'as yet unclassified' }
{ #category : #accessing }
RBInvalidCascadeErrorNode >> cascade [

^ content first
Expand Down
2 changes: 1 addition & 1 deletion src/AST-Core/RBLiteralArrayNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ RBLiteralArrayNode >> replaceNode: aNode withNode: anotherNode [
collect: [:each | each == aNode ifTrue: [anotherNode] ifFalse: [each]])
]

{ #category : #'private-replacing' }
{ #category : #'private - replacing' }
RBLiteralArrayNode >> replaceSourceWith: aNode [
(self class = aNode class and:
[self isForByteArray = aNode isForByteArray
Expand Down
4 changes: 2 additions & 2 deletions src/AST-Core/RBLiteralNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ RBLiteralNode >> precedence [
^0
]

{ #category : #'private-replacing' }
{ #category : #'private - replacing' }
RBLiteralNode >> replaceSourceFrom: aNode [
self addReplacement: (RBStringReplacement
replaceFrom: aNode start
to: aNode stop
with: self formattedCode)
]

{ #category : #'private-replacing' }
{ #category : #'private - replacing' }
RBLiteralNode >> replaceSourceWith: aNode [
self addReplacement: (RBStringReplacement
replaceFrom: self start
Expand Down
8 changes: 4 additions & 4 deletions src/AST-Core/RBMessageNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ RBMessageNode >> isCascaded [
^parent notNil and: [parent isCascade]
]

{ #category : #'private-replacing' }
{ #category : #'private - replacing' }
RBMessageNode >> isContainmentReplacement: aNode [
^(self mappingFor: self receiver) = aNode
or: [self arguments anySatisfy: [:each | (self mappingFor: each) = aNode]]
Expand Down Expand Up @@ -327,7 +327,7 @@ RBMessageNode >> renameSelector: newSelector andArguments: varNodeCollection [
selector: newSelector
]

{ #category : #'private-replacing' }
{ #category : #'private - replacing' }
RBMessageNode >> replaceContainmentSourceWith: aNode [
| originalNode needsParenthesis |
needsParenthesis := aNode hasParentheses not and: [aNode needsParenthesis].
Expand Down Expand Up @@ -358,15 +358,15 @@ RBMessageNode >> replaceNode: aNode withNode: anotherNode [
collect: [:each | each == aNode ifTrue: [anotherNode] ifFalse: [each]])
]

{ #category : #'private-replacing' }
{ #category : #'private - replacing' }
RBMessageNode >> replaceSourceWith: aNode [
(self isContainmentReplacement: aNode)
ifTrue: [^self replaceContainmentSourceWith: aNode].
aNode isMessage ifFalse: [^super replaceSourceWith: aNode].
^self replaceSourceWithMessageNode: aNode
]

{ #category : #'private-replacing' }
{ #category : #'private - replacing' }
RBMessageNode >> replaceSourceWithMessageNode: aNode [
| isBinaryToKeyword newSelectorParts oldkeywordsIntervals|
self numArgs = aNode numArgs ifFalse: [^super replaceSourceWith: aNode].
Expand Down
12 changes: 6 additions & 6 deletions src/AST-Core/RBMethodNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ RBMethodNode >> body: stmtsNode [
body parent: self
]

{ #category : #'private-replacing' }
{ #category : #'private - replacing' }
RBMethodNode >> changeSourceSelector: oldSelector keywordsIntervals: oldIntervals arguments: oldArguments [
"If this is the same number of arguments, we try a one to one replacement of selector parts and arguments. If this is not the c
ase try to rewrite the signature as a whole, what unfortunately drops the comments within the signature."
Expand Down Expand Up @@ -228,12 +228,12 @@ RBMethodNode >> clearReplacements [
replacements := nil
]

{ #category : #'accessing compiled method' }
{ #category : #'accessing - compiled method' }
RBMethodNode >> compilationContext [
^ compilationContext
]

{ #category : #'accessing compiled method' }
{ #category : #'accessing - compiled method' }
RBMethodNode >> compilationContext: aCompilationContext [
compilationContext := aCompilationContext.
]
Expand Down Expand Up @@ -461,20 +461,20 @@ RBMethodNode >> matchPragmas: matchNodes against: pragmaNodes inContext: aDictio
matchNode match: pragmaNode inContext: aDictionary ] ]
]

{ #category : #'accessing compiled method' }
{ #category : #'accessing - compiled method' }
RBMethodNode >> method [
"return the method that I have been compiled for"
^self compilationContext ifNotNil: [ :ccntx |
ccntx compiledMethod ifNil: [ccntx getClass >> self selector]]
]

{ #category : #'accessing compiled method' }
{ #category : #'accessing - compiled method' }
RBMethodNode >> methodClass [

^ self compilationContext ifNotNil: [ :ctxt | ctxt getClass ]
]

{ #category : #'accessing compiled method' }
{ #category : #'accessing - compiled method' }
RBMethodNode >> methodClass: aClass [
compilationContext ifNil: [compilationContext := aClass compiler compilationContext].
self compilationContext class: aClass
Expand Down
Loading

0 comments on commit 1de4954

Please sign in to comment.