Fixed choice inlining.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 29 May 2015 07:25:31 +0100
changeset 476 c45383095de4
parent 475 d47fac0db40b
child 477 b18b6cc7aabc
Fixed choice inlining.
compiler/PPCCodeGenerator.st
compiler/PPCCompiler.st
--- a/compiler/PPCCodeGenerator.st	Wed May 27 08:37:09 2015 +0100
+++ b/compiler/PPCCodeGenerator.st	Fri May 29 07:25:31 2015 +0100
@@ -308,13 +308,16 @@
                     compiler add: 'error ifFalse: [ '.
                     compiler codeReturn: elementVar.  
                     compiler add: ' ].'.
-                ] ifFalse:[  
-                    index < children size ifTrue:[ 
-                        coding value: children value: index + 1.
-                    ] ifFalse:[ 
-                        compiler codeError: 'no choice suitable'.
-                    ].
-                ]
+                ] ifFalse:[ 
+                    compiler add: 'error := true.'.
+                ].
+                compiler add: 'error ifTrue:[ '.
+                index < children size ifTrue:[ 
+                    coding value: children value: index + 1.
+                ] ifFalse:[ 
+                    compiler codeError: 'no choice suitable'.
+                ].
+                compiler add: '] '.
         ]
     ] ifFalse:[ 
         coding := 
@@ -334,7 +337,7 @@
 
     coding value: node children value: 1.
 
-    "Modified: / 26-05-2015 / 19:02:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 29-05-2015 / 07:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 visitEndOfFileNode: node
--- a/compiler/PPCCompiler.st	Wed May 27 08:37:09 2015 +0100
+++ b/compiler/PPCCompiler.st	Fri May 29 07:25:31 2015 +0100
@@ -119,14 +119,14 @@
 
 addConstant: value as: name    
     (constants includesKey: name) ifTrue:[ 
-        (constants at: name) ~~ value ifTrue:[ 
+        (constants at: name) ~= value ifTrue:[ 
             self error:'Duplicate constant!!'.
         ].
         ^ self.
     ].
     constants at: name put: value
 
-    "Modified: / 26-05-2015 / 17:07:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 29-05-2015 / 07:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 addOnLine: string