24 lines
513 B
Smalltalk
24 lines
513 B
Smalltalk
"
|
|
As I go, I do the copy of all the nodes
|
|
"
|
|
Class {
|
|
#name : 'PPCCopyVisitor',
|
|
#superclass : 'PPCRewritingVisitor',
|
|
#category : 'PetitCompiler-Visitors'
|
|
}
|
|
|
|
{ #category : 'as yet unclassified' }
|
|
PPCCopyVisitor >> cache: node value: retval [
|
|
self cache: node value: retval ifPresent: [ :e | self assert: e == retval ]
|
|
]
|
|
|
|
{ #category : 'as yet unclassified' }
|
|
PPCCopyVisitor >> visitNode: node [
|
|
| newNode |
|
|
self change.
|
|
newNode := node copy.
|
|
self cache: node value: newNode.
|
|
|
|
^ super visitNode: newNode.
|
|
]
|