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

reduce-usage-RBVariableNode-subclasses #6880

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/AST-Core-Tests/RBDumpVisitorTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ RBDumpVisitorTest >> testGlobalNodeDump [
node := self parseMethod: 'foo ^ Object'.
dumpedNode := Smalltalk compiler evaluate: node doSemanticAnalysis dump.

self assert: dumpedNode statements first value class equals: RBGlobalNode.
self assert: dumpedNode statements first value isGlobal.
self assert: node class equals: dumpedNode class.
self assert: node printString equals: dumpedNode printString.

Expand Down Expand Up @@ -279,7 +279,7 @@ RBDumpVisitorTest >> testSelfNodeDump [
node := self parseExpression: 'self'.
dumpedNode := Smalltalk compiler evaluate: node dump.

self assert: dumpedNode class equals: RBSelfNode.
self assert: dumpedNode isSelf.
self assert: node class equals: dumpedNode class.
self assert: node printString equals: dumpedNode printString.

Expand All @@ -305,7 +305,7 @@ RBDumpVisitorTest >> testSuperNodeDump [
node := self parseExpression: 'super'.
dumpedNode := Smalltalk compiler evaluate: node dump.

self assert: dumpedNode class equals: RBSuperNode.
self assert: dumpedNode isSuper.
self assert: node class equals: dumpedNode class.
self assert: node printString equals: dumpedNode printString.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ClyInstallMetaLinkPresenterTest >> presenterForMetalinkUninstallation [
ClyInstallMetaLinkPresenterTest >> setUp [
super setUp.
MetaLink uninstallAll.
node := RBTemporaryNode named: 'test'.
node := RBVariableNode named: 'test'.
metalink := MetaLink new.
metalink2 := MetaLink new.
breakpoint := MetaLink new metaObject: Break; yourself.
Expand Down
16 changes: 0 additions & 16 deletions src/OpalCompiler-Tests/OCVariableSpecialisationTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,3 @@ Class {
#superclass : #TestCase,
#category : #'OpalCompiler-Tests-Misc'
}

{ #category : #tests }
OCVariableSpecialisationTest >> testVarTemp [
| sequenceNode returnNode |
sequenceNode := RBParser parseExpression: '| t1 t2 t3 | t1 := 1. t2 := 2. t3 := 3. ^t2'.
returnNode := sequenceNode statements last.

"before semantic analysis, this is just a variableNode"
self assert: returnNode value class identicalTo: RBVariableNode.
self deny: returnNode value class identicalTo: RBTemporaryNode.

sequenceNode doSemanticAnalysis.
"after, it is specialized to a temporary"
returnNode := sequenceNode statements last.
self assert: returnNode value class identicalTo: RBTemporaryNode
]
12 changes: 6 additions & 6 deletions src/Reflectivity/RFArgumentsReification.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ RFArgumentsReification class >> key [

{ #category : #generate }
RFArgumentsReification >> genForRBMessageNode [
^RBTemporaryNode named: self varName.
^RBVariableNode named: self varName.
]

{ #category : #generate }
RFArgumentsReification >> genForRBMethodNode [
^RBTemporaryNode named: self varName.
^RBVariableNode named: self varName.
]

{ #category : #generate }
RFArgumentsReification >> genForRBSequenceNode [
^RBTemporaryNode named: self varName.
^RBVariableNode named: self varName.
]

{ #category : #preamble }
Expand All @@ -47,7 +47,7 @@ RFArgumentsReification >> preambleForMessage: aNode [
(1 to: aNode numArgs) withIndexDo: [:each :index |
| name |
name := 'RFArg', index asString, 'RFReification'.
arguments add: (RBTemporaryNode named: name).
arguments add: (RBVariableNode named: name).
].
preamble addAll: (RBArrayNode statements: arguments).
preamble add: (RFStorePopIntoTempNode named: self varName).
Expand All @@ -59,7 +59,7 @@ RFArgumentsReification >> preambleForMessage: aNode [
RFArgumentsReification >> preambleForMethod: aNode [
| preamble arguments |
preamble := OrderedCollection new.
arguments := aNode argumentNames collect: [ :name | RBTemporaryNode named: name].
arguments := aNode argumentNames collect: [ :name | RBVariableNode named: name].
preamble addAll: (RBArrayNode statements: arguments).
preamble add: (RFStorePopIntoTempNode named: self varName).
^ preamble
Expand All @@ -69,7 +69,7 @@ RFArgumentsReification >> preambleForMethod: aNode [
RFArgumentsReification >> preambleSequence: aNode [
| preamble arguments |
preamble := OrderedCollection new.
arguments := aNode parent argumentNames collect: [ :name | RBTemporaryNode named: name].
arguments := aNode parent argumentNames collect: [ :name | RBVariableNode named: name].
preamble addAll: (RBArrayNode statements: arguments).
preamble add: (RFStorePopIntoTempNode named: self varName).
^ preamble
Expand Down
4 changes: 2 additions & 2 deletions src/Reflectivity/RFMethodToExecuteReification.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RFMethodToExecuteReification class >> key [
{ #category : #generate }
RFMethodToExecuteReification >> genForRBMessageNode [
^RBMessageNode
receiver: (RBMessageNode receiver: (RBTemporaryNode named: #RFReceiverReificationVar) selector: #class)
receiver: (RBMessageNode receiver: (RBVariableNode named: #RFReceiverReificationVar) selector: #class)
selector: #lookupSelector:
arguments: (RBLiteralValueNode value: entity selector)
]
Expand All @@ -42,7 +42,7 @@ RFMethodToExecuteReification >> preambleForMessage: aNode [
(1 to: aNode numArgs) withIndexDo: [:each :index |
| name |
name := 'RFArg', index asString, 'RFReification'.
preamble add: (RBTemporaryNode named: name).
preamble add: (RBVariableNode named: name).
].

^ preamble
Expand Down
4 changes: 2 additions & 2 deletions src/Reflectivity/RFNewValueReification.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ RFNewValueReification class >> key [

{ #category : #generate }
RFNewValueReification >> genForRBAssignmentNode [
^RBTemporaryNode named: #RFNewValueReificationVar.
^RBVariableNode named: #RFNewValueReificationVar.
]

{ #category : #generate }
RFNewValueReification >> genForRBVariableNode [
"same as #value for variableNodes"
^RBTemporaryNode named: #RFNewValueReificationVar.
^RBVariableNode named: #RFNewValueReificationVar.
]

{ #category : #preamble }
Expand Down
6 changes: 3 additions & 3 deletions src/Reflectivity/RFOperationReification.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ RFOperationReification >> preambleForArray: aNode [
(1 to: aNode size) withIndexDo: [:each :index |
| name |
name := 'RFArg', index asString, 'RFReification'.
arguments add: (RBTemporaryNode named: name).
arguments add: (RBVariableNode named: name).
].
preamble addAll: (RBArrayNode statements: arguments).
preamble add: (RFStorePopIntoTempNode named: 'RFReifyValueVar').
Expand Down Expand Up @@ -170,7 +170,7 @@ RFOperationReification >> preambleForMessage: aNode [
(1 to: aNode numArgs) withIndexDo: [:each :index |
| name |
name := 'RFArg', index asString, 'RFReification'.
arguments add: (RBTemporaryNode named: name).
arguments add: (RBVariableNode named: name).
].
preamble addAll: (RBArrayNode statements: arguments).
preamble add: (RFStorePopIntoTempNode named: 'RFArgumentsReificationVar').
Expand All @@ -182,7 +182,7 @@ RFOperationReification >> preambleForMessage: aNode [
RFOperationReification >> preambleForMethod: aNode [
| preamble arguments |
preamble := OrderedCollection new.
arguments := aNode argumentNames collect: [ :name | RBTemporaryNode named: name].
arguments := aNode argumentNames collect: [ :name | RBVariableNode named: name].
preamble addAll: (RBArrayNode statements: arguments).
preamble add: (RFStorePopIntoTempNode named: 'RFArgumentsReificationVar').
^ preamble
Expand Down
4 changes: 2 additions & 2 deletions src/Reflectivity/RFReceiverReification.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ RFReceiverReification class >> key [

{ #category : #generate }
RFReceiverReification >> genForRBMessageNode [
^RBTemporaryNode named: #RFReceiverReificationVar.
^RBVariableNode named: #RFReceiverReificationVar.
]

{ #category : #generate }
Expand All @@ -43,7 +43,7 @@ RFReceiverReification >> preambleForMessage: aNode [
(1 to: aNode numArgs) withIndexDo: [:each :index |
| name |
name := 'RFArg', index asString, 'RFReification'.
preamble add: (RBTemporaryNode named: name).
preamble add: (RBVariableNode named: name).
].

^ preamble
Expand Down
4 changes: 2 additions & 2 deletions src/Reflectivity/RFValueReification.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ RFValueReification >> genForRBMessageNode [

{ #category : #generate }
RFValueReification >> genForRBMethodNode [
^RBTemporaryNode named: self varName
^RBVariableNode named: self varName
]

{ #category : #generate }
Expand Down Expand Up @@ -123,7 +123,7 @@ RFValueReification >> preambleForArray: aNode [
(1 to: aNode size) withIndexDo: [:each :index |
| name |
name := 'RFArg', index asString, 'RFReification'.
arguments add: (RBTemporaryNode named: name).
arguments add: (RBVariableNode named: name).
].
preamble addAll: (RBArrayNode statements: arguments).
preamble add: (RFStorePopIntoTempNode named: self varName).
Expand Down