compiler/tests/PPCInliningVisitorTest.st
changeset 444 a3657ab0ca6b
parent 438 20598d7ce9fa
child 453 bd5107faf4d6
equal deleted inserted replaced
443:2c87ed364404 444:a3657ab0ca6b
     6 	instanceVariableNames:'node result visitor'
     6 	instanceVariableNames:'node result visitor'
     7 	classVariableNames:''
     7 	classVariableNames:''
     8 	poolDictionaries:''
     8 	poolDictionaries:''
     9 	category:'PetitCompiler-Tests-Visitors'
     9 	category:'PetitCompiler-Tests-Visitors'
    10 !
    10 !
       
    11 
    11 
    12 
    12 !PPCInliningVisitorTest methodsFor:'as yet unclassified'!
    13 !PPCInliningVisitorTest methodsFor:'as yet unclassified'!
    13 
    14 
    14 assert: object type: class
    15 assert: object type: class
    15 	self assert: object class == class
    16 	self assert: object class == class
    97 	self assert: result child isMarkedForInline.
    98 	self assert: result child isMarkedForInline.
    98 	self assert: result child literal = 'foo'.
    99 	self assert: result child literal = 'foo'.
    99 !
   100 !
   100 
   101 
   101 testPluggable
   102 testPluggable
   102 	| pluggableNode |
   103     | pluggableNode |
   103 	pluggableNode := PPCPluggableNode new
   104     pluggableNode := PPCPluggableNode new
   104 		block: [:ctx | nil] asParser.
   105             block: [:ctx | nil] asParser.
   105 	node := PPCSequenceNode new
   106     node := PPCSequenceNode new
   106 		children: { pluggableNode  };
   107             children: { pluggableNode  };
   107 		yourself.
   108             yourself.
   108 
   109 
   109 	result := visitor visit: node.
   110     result := visitor visit: node.
   110 	    
   111         
   111 	((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:
   112     ((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:[  
   112 	[  
   113         self skipIf: true description: 'skipped test, inlining of pluggable nodes not supported!!'.
   113 		self skip: 'skipped test, inlining of pluggable nodes not supported!!'.
   114     ].
   114 	].
       
   115 
   115 
   116 	self assert: result children first type: PPCPluggableNode.
   116     self assert: result children first type: PPCPluggableNode.
   117 	self assert: result children first isMarkedForInline.
   117     self assert: result children first isMarkedForInline.
   118 
   118 
   119     "Modified: / 23-04-2015 / 12:18:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   119     "Modified: / 01-05-2015 / 14:22:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   120 !
   120 !
   121 
   121 
   122 testSequenceInline
   122 testSequenceInline
   123 	| charNode1 charNode2 |
   123 	| charNode1 charNode2 |
   124 	charNode1 := PPCCharacterNode new
   124 	charNode1 := PPCCharacterNode new
   170 	self assert: result child type: PPCTokenStarSeparatorNode.
   170 	self assert: result child type: PPCTokenStarSeparatorNode.
   171 	self assert: result child isMarkedForInline.
   171 	self assert: result child isMarkedForInline.
   172 	self assert: result child child type: PPCNilNode.
   172 	self assert: result child child type: PPCNilNode.
   173 ! !
   173 ! !
   174 
   174 
       
   175 !PPCInliningVisitorTest class methodsFor:'documentation'!
       
   176 
       
   177 version_HG
       
   178 
       
   179     ^ '$Changeset: <not expanded> $'
       
   180 ! !
       
   181