compiler/PPCCodeGenerator.st
changeset 460 87a3d30ab570
parent 453 bd5107faf4d6
parent 459 4751c407bb40
child 465 f729f6cd3c76
--- a/compiler/PPCCodeGenerator.st	Mon May 11 18:31:26 2015 +0100
+++ b/compiler/PPCCodeGenerator.st	Tue May 12 01:33:33 2015 +0100
@@ -11,6 +11,12 @@
 
 !PPCCodeGenerator class methodsFor:'as yet unclassified'!
 
+new
+    ^ self basicNew
+        initialize;
+        yourself 
+!
+
 on: aPPCCompiler
     ^ self new 
         compiler: aPPCCompiler;
@@ -21,6 +27,10 @@
 
 compiler: aPPCCompiler
     compiler := aPPCCompiler 
+!
+
+guards
+    ^ arguments guards
 ! !
 
 !PPCCodeGenerator methodsFor:'hooks'!
@@ -48,7 +58,7 @@
 
 addGuard: node
     |  guard firsts id |
-    (arguments guards not or: [(guard := PPCGuard on: node) makesSense not]) ifTrue: [ ^ self].
+    (self guards not or: [(guard := PPCGuard on: node) makesSense not]) ifTrue: [ ^ self].
 
     id := compiler idFor: node.
     firsts := node firstSetWithTokens.
@@ -245,12 +255,6 @@
         ^ nil
     ].
 
-    "TODO JK: this is is wrong,.. to tired now to fix this :("
-"	(self isCached: child) ifTrue: [ 
-        node replace: child with: (self cachedValue: child).
-        ^ nil
-    ]. 
-"
     ^ self visit: child.
 !
 
@@ -268,7 +272,7 @@
         If we want to compile in guard and the choice starts with trimming token, 
         we should invoke the whitespace parser
     "
-    (arguments guards and: [ firsts allSatisfy: [ :e | e isTrimmingTokenNode ] ]) ifTrue: [  
+    (self guards and: [ firsts allSatisfy: [ :e | e isTrimmingTokenNode ] ]) ifTrue: [  
         self compileTokenWhitespace: firsts anyOne.
         whitespaceConsumed := true.
     ].
@@ -277,7 +281,7 @@
         child := node children at: idx.
         allowGuard := whitespaceConsumed.
                                 
-        (allowGuard and: [arguments guards and: [ (guard := PPCGuard on: child) makesSense ]]) ifTrue: [         
+        (allowGuard and: [self guards and: [ (guard := PPCGuard on: child) makesSense ]]) ifTrue: [         
             guard id: (compiler idFor: guard prefixed: #guard).
             guard compileGuard: compiler.
             compiler add: ' ifTrue: [ '.