--- a/compiler/TCompilerPass.st Mon Sep 14 11:19:10 2015 +0100
+++ b/compiler/TCompilerPass.st Mon Sep 14 15:03:03 2015 +0100
@@ -6,9 +6,29 @@
instanceVariableNames:'context currentClass currentMethod currentScope'
classVariableNames:''
poolDictionaries:''
- category:'Languages-Tea-Compiler'
+ category:'Languages-Tea-Compiler-Internals'
+!
+
+!TCompilerPass class methodsFor:'running'!
+
+runOn: anObject
+ ^ self new runOn: anObject
+
+ "Created: / 14-09-2015 / 13:57:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+runOn: anObject inContext: aTCompilerContext
+ ^ self new runOn: anObject inContext: aTCompilerContext
+
+ "Created: / 14-09-2015 / 13:57:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+runOn: anObject inEnvironment: aTEnvironment
+ ^ self new runOn: anObject inEnvironment: aTEnvironment
+
+ "Created: / 14-09-2015 / 13:57:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!TCompilerPass methodsFor:'accessing'!
context
@@ -22,17 +42,41 @@
!TCompilerPass methodsFor:'running'!
run
- self run: context unit
+ self runOn: context unit
"Created: / 31-08-2015 / 11:52:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 14-09-2015 / 13:54:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-run: anObject
+runOn: anObject
+ context isNil ifTrue:[
+ context := TCompilerContext new.
+ context environment: TEnvironment new.
+ context unit: anObject.
+ ].
anObject isRingObject
ifTrue:[ self visitDefinition: anObject ]
ifFalse:[ self visitNode: anObject ]
- "Created: / 29-08-2015 / 21:45:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 14-09-2015 / 13:54:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+runOn: anObject inContext: aTCompilerContext
+ self context: aTCompilerContext.
+ self runOn: anObject
+
+ "Created: / 14-09-2015 / 13:55:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+runOn: anObject inEnvironment: aTEnvironment
+ context isNil ifTrue:[
+ context := TCompilerContext new.
+ context unit: anObject.
+ ].
+ context environment: aTEnvironment.
+ self runOn: anObject
+
+ "Created: / 14-09-2015 / 13:59:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TCompilerPass methodsFor:'visiting'!
@@ -73,6 +117,18 @@
"Created: / 14-09-2015 / 10:31:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
+acceptIfTrueIfFalseNode: node
+ self acceptMessageNode: node
+
+ "Created: / 14-09-2015 / 14:09:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+acceptIfTrueNode: node
+ self acceptMessageNode: node
+
+ "Created: / 14-09-2015 / 14:09:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
acceptInlineAssemblyNode: aMethodNode
"Created: / 02-09-2015 / 07:03:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -112,5 +168,26 @@
].
"Created: / 02-09-2015 / 07:16:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+acceptSpecialFormNode:aTSpecialFormNode
+ aTSpecialFormNode selector = #ifTrue: ifTrue:[
+ ^ self acceptIfTrueNode:aTSpecialFormNode.
+ ].
+ aTSpecialFormNode selector = #ifTrue:ifFalse: ifTrue:[
+ ^ self acceptIfTrueIfFalseNode:aTSpecialFormNode.
+ ].
+ aTSpecialFormNode selector = #whileTrue: ifTrue:[
+ ^ self acceptWhileTrueNode:aTSpecialFormNode.
+ ].
+ ^ self error:'Unsupported special form: #' , aTSpecialFormNode selector
+
+ "Created: / 14-09-2015 / 14:09:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+acceptWhileTrueNode: node
+ self acceptMessageNode: node
+
+ "Created: / 14-09-2015 / 14:09:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !