Hi everyone,

does anyone have a better knowledge about replacing nodes in AST? Because what 
I saw is that there are methods like replaceSourceWith: that can be sent to an 
AST node with another AST node as a parameter. But this is not enough to get a 
new source code. Because when you ask the AST for newSource it generates a new 
source by taking replacements into account, parses the new source, compares it 
with itself and in case the new parse tree is equal it returns the new source. 
So it’s not enough to just use replaceSourceWith: but you also have to replace 
the current node with a new one it AST.

Now the question is: am I doing something wrong, or we have strange API because 
we need to replace both source and node, replacing only one of them does not 
work…

Uko

Reply via email to