equal
deleted
inserted
replaced
139 |
139 |
140 callOnLine: anotherMethod |
140 callOnLine: anotherMethod |
141 currentMethod addOnLine: anotherMethod call. |
141 currentMethod addOnLine: anotherMethod call. |
142 ! |
142 ! |
143 |
143 |
|
144 codeComment: string |
|
145 currentMethod add: '"', string, '"'. |
|
146 ! |
|
147 |
144 dedent |
148 dedent |
145 currentMethod dedent |
149 currentMethod dedent |
146 ! |
150 ! |
147 |
151 |
148 indent |
152 indent |
242 |
246 |
243 "TODO JK: Hack alert, whatever is magic constant!!" |
247 "TODO JK: Hack alert, whatever is magic constant!!" |
244 (variable == #whatever) ifFalse: [ |
248 (variable == #whatever) ifFalse: [ |
245 "Do not assign, if somebody does not care!!" |
249 "Do not assign, if somebody does not care!!" |
246 self add: variable, ' ', selector,' ', argument. |
250 self add: variable, ' ', selector,' ', argument. |
247 ] ifTrue: [ |
251 ] ifTrue: [ |
248 "In case argument has a side effect" |
252 "In case argument has a side effect" |
249 self add: argument |
253 self add: argument |
250 ] |
254 ] |
251 ! |
255 ! |
252 |
256 |
253 codeEvaluateAndAssign: argument to: variable |
257 codeEvaluateAndAssign: argument to: variable |
254 self assert: variable isNil not. |
258 self assert: variable isNil not. |
257 (variable == #whatever) ifFalse: [ |
261 (variable == #whatever) ifFalse: [ |
258 "Do not assign, if somebody does not care!!" |
262 "Do not assign, if somebody does not care!!" |
259 self add: variable ,' := ', argument. |
263 self add: variable ,' := ', argument. |
260 ] ifTrue: [ |
264 ] ifTrue: [ |
261 "In case an argument has a side effect" |
265 "In case an argument has a side effect" |
262 self add: argument. |
266 self add: argument. |
263 ] |
267 ] |
264 ! |
268 ! |
265 |
269 |
266 codeHalt |
270 codeHalt |
267 self add: 'self halt. ' |
271 self add: 'self halt. ' |
335 "Created: / 01-06-2015 / 21:19:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
339 "Created: / 01-06-2015 / 21:19:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
336 ! |
340 ! |
337 |
341 |
338 codeReturn |
342 codeReturn |
339 currentMethod isInline ifTrue: [ |
343 currentMethod isInline ifTrue: [ |
340 "If inlined, the return variable already holds the value" |
344 "If inlined, the return variable already holds the value" |
341 ] ifFalse: [ |
345 ] ifFalse: [ |
342 arguments profile ifTrue:[ |
346 arguments profile ifTrue:[ |
343 self codeProfileStop. |
347 self codeProfileStop. |
344 ]. |
348 ]. |
345 self add: '^ ', currentMethod returnVariable |
349 self add: '^ ', currentMethod returnVariable |
346 ]. |
350 ]. |
347 |
351 |
348 "Created: / 23-04-2015 / 18:01:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
352 "Created: / 23-04-2015 / 18:01:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
349 "Modified: / 01-06-2015 / 21:49:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
353 "Modified: / 01-06-2015 / 21:49:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
350 ! |
354 ! |
351 |
355 |
352 codeReturn: code |
356 codeReturn: code |
353 " - returns whatever is in code OR |
357 " - returns whatever is in code OR |
354 - assigns whatever is in code into the returnVariable" |
358 - assigns whatever is in code into the returnVariable" |
563 "Modified: / 01-06-2015 / 21:37:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
567 "Modified: / 01-06-2015 / 21:37:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
564 ! |
568 ! |
565 |
569 |
566 stopMethod |
570 stopMethod |
567 self cache: currentMethod methodName as: currentMethod. |
571 self cache: currentMethod methodName as: currentMethod. |
568 |
572 |
569 "arguments profile ifTrue: [ Transcript show: currentMethod code; cr. ]." |
573 "arguments profile ifTrue: [ Transcript show: currentMethod code; cr. ]." |
570 ^ self pop. |
574 ^ self pop. |
571 |
575 |
572 "Modified: / 01-06-2015 / 21:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
576 "Modified: / 01-06-2015 / 21:38:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
573 ! |
577 ! |
574 |
578 |
575 top |
579 top |
576 ^ compilerStack top |
580 ^ compilerStack top |
577 ! ! |
581 ! ! |
622 ] |
626 ] |
623 ! |
627 ! |
624 |
628 |
625 installMethods |
629 installMethods |
626 cache keysAndValuesDo: [ :key :method | |
630 cache keysAndValuesDo: [ :key :method | |
627 compiledParser compileSilently: method code classified: method category. |
631 compiledParser compileSilently: method source classified: method category. |
628 ] |
632 ] |
|
633 |
|
634 "Modified: / 24-07-2015 / 19:45:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
629 ! |
635 ! |
630 |
636 |
631 installVariables |
637 installVariables |
632 | varString | |
638 | varString | |
633 varString := constants keys inject: '' into: [:r :e | r, ' ', e ]. |
639 varString := constants keys inject: '' into: [:r :e | r, ' ', e ]. |