Documentation of class 'ParseTreeSourceRewriter':
Object | +--RBProgramNodeVisitor | +--ParseTreeSearcher | +--ParseTreeRewriter | +--ParseTreeSourceRewriter
This is a parse tree rewriter which does NOT generate new code from scratch (i.e. it does not generate its source by recursively walking along the formattedCode methods), but instead inserts the new nodes code right into the original source code. This has two advantages: it does not destroy the user's formatting, indentation etc. it does not forget comments. I added this, because I constantly got mad at the rewriter reformatting my code for every tiny little variable rewrite operation. Caveats: needs more intelligence when rewriting non-trivial code, such as keyword message sends. For now, it seems to only behave reasonable for very simple stuff, such as replacing a variable by another or by a simple unary send.
ST/X 126.96.36.199; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Mon, 29 May 2023 12:07:39 GMT