compiler/PPCMethod.st
changeset 478 711c8bc1ec04
parent 477 b18b6cc7aabc
child 479 6316a98b7150
--- a/compiler/PPCMethod.st	Mon Jun 01 22:02:17 2015 +0100
+++ b/compiler/PPCMethod.st	Mon Jun 01 23:15:52 2015 +0100
@@ -100,6 +100,37 @@
     ^ ''
 ! !
 
+!PPCMethod methodsFor:'code generation'!
+
+code: aStringOrBlock
+    buffer code: aStringOrBlock.
+
+    "Created: / 01-06-2015 / 22:31:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+codeBlock: contents
+    | outerBlock innerBlock |
+
+    outerBlock := buffer.
+    innerBlock := PPCCodeBlock new.
+    innerBlock indentationLevel: outerBlock indentationLevel + 1.  
+    [ 
+        buffer addOnLine:'['.
+        buffer := innerBlock.
+        self code: contents.
+    ] ensure:[
+        buffer := outerBlock.
+        buffer 
+            code: (String streamContents:[:s | innerBlock codeOn: s]);
+            nl;
+            codeIndent.
+
+        buffer addOnLine:']'.
+    ]
+
+    "Created: / 01-06-2015 / 22:33:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !PPCMethod methodsFor:'code generation - indenting'!
 
 dedent