120 "Modified (comment): / 18-06-2015 / 06:04:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
120 "Modified (comment): / 18-06-2015 / 06:04:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
121 ! ! |
121 ! ! |
122 |
122 |
123 !PPCCodeBlock methodsFor:'printing and storing'! |
123 !PPCCodeBlock methodsFor:'printing and storing'! |
124 |
124 |
125 codeOn: aStream |
125 sourceOn:aStream |
126 "Dumps generated code on given stream" |
126 "Dumps generated code on given stream" |
127 |
127 |
128 temporaries notEmpty ifTrue:[ |
128 temporaries notEmpty ifTrue:[ |
129 ((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:[ |
129 ((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:[ |
130 indentation * 4 timesRepeat: [ aStream nextPut: Character space ]. |
130 indentation * 4 timesRepeat:[ |
131 ] ifFalse:[ |
131 aStream nextPut:Character space |
132 indentation timesRepeat: [ aStream nextPut: Character tab ]. |
132 ]. |
|
133 ] ifFalse:[ |
|
134 indentation timesRepeat:[ |
|
135 aStream nextPut:Character tab |
|
136 ]. |
133 ]. |
137 ]. |
134 aStream nextPut: $|. |
138 aStream nextPut:$|. |
135 temporaries do:[:e | aStream space; nextPutAll: e ]. |
139 temporaries do:[:e | |
|
140 aStream |
|
141 space; |
|
142 nextPutAll:e |
|
143 ]. |
136 aStream space. |
144 aStream space. |
137 aStream nextPut: $|. |
145 aStream nextPut:$|. |
138 self nl. |
146 self nl. |
139 "In Smalltalk/X, there should be a blank line after temporaries" |
147 "In Smalltalk/X, there should be a blank line after temporaries" |
140 ((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:[ |
148 ((Smalltalk respondsTo:#isSmalltalkX) and:[ Smalltalk isSmalltalkX ]) ifTrue:[ |
141 self nl. |
149 self nl. |
142 ]. |
150 ]. |
143 ]. |
151 ]. |
144 aStream nextPutAll: buffer contents |
152 aStream nextPutAll:buffer contents |
145 |
153 |
146 "Created: / 01-06-2015 / 21:26:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
154 "Created: / 01-06-2015 / 21:26:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
147 ! ! |
155 ! ! |
148 |
156 |
149 !PPCCodeBlock methodsFor:'private'! |
157 !PPCCodeBlock methodsFor:'private'! |