Hi Alexandre, sorry for not answering before, I hadn't noticed the message.
The problem is that I have a code generation visitor traversing the AST. I need to generate different parts of the method from different methods of the visitor. I don't see how your approach may fit, that's why I need to implement it this way.
Thank you, Marian
Alexandre Bergel wrote:
Hi Mariano!
cb := self commandBuilder m := cb methodNamed: #conditionMethod withFormalArgs: #() comment: 'Condition method'. m send: #ifTrue:ifFalse: to: (cb send: #isNil to: cb nil) with: (cb block: [:blk | blk return: (cb literal:'true')])
with: (cb block: [:blk | blk return: (cb literal: 'false')]).
I was wondering in which case do you _really_ need such an approach?
Why not something like to be evaluated in a workspace:
Parser new parse: 'conditionMethod "Condition method" nil isNil ifTrue:[^true] ifFalse:[^false]' class: nil class
Cheers, Alexandre --_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.iam.unibe.ch/~bergel ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.