--- a/compiler/PPCCodeGenerator.st Fri Jun 05 00:05:08 2015 +0100
+++ b/compiler/PPCCodeGenerator.st Mon Jun 15 17:12:54 2015 +0100
@@ -9,6 +9,7 @@
category:'PetitCompiler-Visitors'
!
+
!PPCCodeGenerator class methodsFor:'as yet unclassified'!
new
@@ -219,16 +220,18 @@
"Block return value is return value of last statement.
So if the method is not inline, make last statement a return.
if the method is inline, make it assignment to retvalVar."
- compiler currentMethod isInline ifTrue:[
- | assignment |
+ blockBody statements notEmpty ifTrue:["Care for empty blocks - [:t | ] !!"
+ compiler currentMethod isInline ifTrue:[
+ | assignment |
- assignment := RBAssignmentNode variable: (RBVariableNode named: self retvalVar) value: blockBody statements last.
- blockBody replaceNode: blockBody statements last withNode: assignment.
- ] ifFalse:[
- | return |
+ assignment := RBAssignmentNode variable: (RBVariableNode named: self retvalVar) value: blockBody statements last.
+ blockBody replaceNode: blockBody statements last withNode: assignment.
+ ] ifFalse:[
+ | return |
- return := RBReturnNode value: blockBody statements last.
- blockBody replaceNode: blockBody statements last withNode: return.
+ return := RBReturnNode value: blockBody statements last.
+ blockBody replaceNode: blockBody statements last withNode: return.
+ ].
].
compiler codeStoreValueOf: [ self visit: node child ] intoVariable: self retvalVar.
@@ -238,7 +241,7 @@
compiler code: blockBody.
]
- "Modified: / 01-06-2015 / 23:58:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 15-06-2015 / 17:08:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
visitAndNode: node
@@ -911,3 +914,10 @@
compiler codeReturn.
! !
+!PPCCodeGenerator class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+