Hi Peter,
Hi Peter,

you should try {:node :dic | ... } to handle that.

Something like:

RBParseTreeRewriter new
        replace: '`@var `{:node :dic | dic at: #varName put: node name} := 
`@arg'
        with: 'self write: `@arg into: `{:dic |
                RBParser parseExpression: ''#'', (dic at: #varName) }'.

You need to adjust, I haven't checked if this is correct ;).

Thierry


Le 11/11/2017 à 17:17, Peter Uhnák a écrit :
Hi,

how can I rewrite a(n instance) variable to a symbol?

E.g.

[IN]
something: aSomething
     something := aSomething

[OUT]
something: aSomething
     self write: aSomething into: #something


I can capute the input just fine... ``@var := ``@arg
but I have no idea how to convert the var into a symbol (or string).

Thanks,
Peter



Reply via email to