compiler/PPCCodeGenerator.st
changeset 516 3b81c9e53352
parent 506 e5d63143737f
parent 515 b5316ef15274
child 525 751532c8f3db
--- a/compiler/PPCCodeGenerator.st	Fri Jul 31 14:07:31 2015 +0100
+++ b/compiler/PPCCodeGenerator.st	Mon Aug 17 12:56:02 2015 +0100
@@ -131,7 +131,7 @@
         compiler addOnLine: '].'.
     ]."
     
-    guard id: (compiler idFor: guard prefixed: #guard).
+    guard id: (compiler idFor: guard defaultName: #guard).
     guard compileGuard: compiler.
 
     trueBlock isNil ifFalse: [ 
@@ -263,7 +263,7 @@
     | classificationId  classification |
     self error: 'deprecated.'.
     classification := node extendClassification: node predicate classification.
-    classificationId := (compiler idFor: classification prefixed: #classification).
+    classificationId := (compiler idFor: classification defaultName: #classification).
     compiler  addConstant: classification as: classificationId.
     
     compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'.
@@ -304,11 +304,11 @@
 startMethodForNode:node
     node isMarkedForInline ifTrue:[ 
         compiler startInline: (compiler idFor: node).
-        compiler addComment: 'BEGIN inlined code of ' , node printString.
+        compiler codeComment: 'BEGIN inlined code of ' , node printString.
         compiler indent.
     ] ifFalse:[ 
         compiler startMethod: (compiler idFor: node).
-        compiler addComment: 'GENERATED by ' , node printString.
+        compiler codeComment: 'GENERATED by ' , node printString.
         compiler allocateReturnVariable.
     ].
 
@@ -473,7 +473,7 @@
 
     | classification classificationId |
     classification := node extendClassification: node predicate classification.
-    classificationId := compiler idFor: classification prefixed: #classification.
+    classificationId := compiler idFor: classification defaultName: #classification.
     compiler addConstant: classification as: classificationId.
     
     compiler add: '(', classificationId, ' at: context peek asInteger)'.
@@ -491,7 +491,7 @@
     node character ppcPrintable ifTrue: [ 
         chid := node character storeString 
     ] ifFalse: [ 
-        chid := compiler idFor: node character prefixed: #char.
+        chid := compiler idFor: node character defaultName: #char.
         compiler addConstant: (Character value: node character asInteger) as: chid .
     ].
     
@@ -656,7 +656,7 @@
 visitNotCharSetPredicateNode: node
     | classificationId  classification |
     classification := node extendClassification: node predicate classification.
-    classificationId := (compiler idFor: classification prefixed: #classification).
+    classificationId := (compiler idFor: classification defaultName: #classification).
     compiler  addConstant: classification as: classificationId.
     
     compiler addOnLine: '(', classificationId, ' at: context peek asInteger)'.
@@ -674,7 +674,7 @@
     node character ppcPrintable ifTrue: [ 
         chid := node character storeString 
     ] ifFalse: [ 
-        chid := compiler idFor: node character prefixed: #char.
+        chid := compiler idFor: node character defaultName: #char.
         compiler addConstant: (Character value: node character asInteger) as: chid .
     ].
     
@@ -747,7 +747,7 @@
 
 visitPluggableNode: node
     | blockId |
-    blockId := compiler idFor: node block prefixed: #block.
+    blockId := compiler idFor: node block defaultName: #pluggableBlock.
     
     compiler addConstant: node block as: blockId.
     compiler codeReturn: blockId, ' value: context.'.
@@ -793,7 +793,7 @@
 
 visitPredicateNode: node
     | pid |
-    pid := (compiler idFor: node predicate prefixed: #predicate).
+    pid := (compiler idFor: node predicate defaultName: #predicate).
 
     compiler addConstant: node predicate as: pid.
 
@@ -884,7 +884,7 @@
     
 
     classification := node extendClassification: node predicate classification.
-    classificationId := compiler idFor: classification prefixed: #classification.
+    classificationId := compiler idFor: classification defaultName: #classification.
     compiler addConstant: classification as: classificationId.
     
     compiler codeAssign: 'OrderedCollection new.' to: self retvalVar.	
@@ -916,8 +916,15 @@
 
     self addGuard: node child ifTrue: nil ifFalse: [ compiler codeReturn: '#()' ].
 
-    compiler codeAssign: 'OrderedCollection new.' to: self retvalVar.
     compiler codeAssignParsedValueOf:[ self visit:node child ] to:elementVar.
+    compiler codeIf: 'error' 
+        then: [ 
+            compiler codeClearError.
+            compiler codeReturn: '#()'.
+        ] else: [
+            compiler codeAssign: 'OrderedCollection new.' to: self retvalVar.
+        ].
+
     compiler add: '[ error ] whileFalse: ['.
     compiler indent.
     compiler add: self retvalVar, ' add: ', elementVar, '.'.