compiler/PPCListNode.st
changeset 438 20598d7ce9fa
parent 422 116d2b2af905
child 452 9f4558b3be66
equal deleted inserted replaced
437:54b3bc9e3987 438:20598d7ce9fa
    23 !
    23 !
    24 
    24 
    25 children: anObject
    25 children: anObject
    26 	
    26 	
    27 	children := anObject
    27 	children := anObject
       
    28 !
       
    29 
       
    30 firstChild
       
    31 	^ self children first
       
    32 !
       
    33 
       
    34 secondChild
       
    35 	^ self children second
    28 ! !
    36 ! !
    29 
    37 
    30 !PPCListNode methodsFor:'analysis'!
    38 !PPCListNode methodsFor:'analysis'!
    31 
    39 
    32 acceptsEpsilon
    40 acceptsEpsilon
    33 	self subclassResponsibility
    41 	self subclassResponsibility
    34 !
    42 !
    35 
    43 
    36 acceptsEpsilonOpenSet: set
    44 acceptsEpsilonOpenSet: set
    37 	self subclassResponsibility
    45 	self subclassResponsibility
    38 !
       
    39 
       
    40 replace: node with: anotherNode
       
    41 	children keysAndValuesDo: [ :index :child |
       
    42 		child == node ifTrue: [ children at: index put: anotherNode ] 
       
    43 	]
       
    44 ! !
    46 ! !
    45 
    47 
    46 !PPCListNode methodsFor:'copying'!
    48 !PPCListNode methodsFor:'copying'!
    47 
    49 
    48 postCopy
    50 postCopy
    49 	super postCopy.
    51 	super postCopy.
    50 	children := children copy
    52 	children := children copy
    51 ! !
    53 ! !
    52 
    54 
    53 !PPCListNode methodsFor:'optimizing'!
    55 !PPCListNode methodsFor:'transformation'!
    54 
    56 
    55 inline: changeStatus
    57 replace: node with: anotherNode
    56 	| inlinedNode |
    58 	children keysAndValuesDo: [ :index :child |
    57 	self children do: [ :child |
    59 		child == node ifTrue: [ children at: index put: anotherNode ] 
    58 		inlinedNode := child asInlined.
       
    59 		(inlinedNode ~= child) ifTrue: [ 
       
    60 			changeStatus change.
       
    61 			^ self replace: child with: inlinedNode.
       
    62 		]
       
    63 	]
    60 	]
    64 ! !
    61 ! !
    65 
    62 
    66 !PPCListNode class methodsFor:'documentation'!
    63 !PPCListNode class methodsFor:'documentation'!
    67 
    64