[RC Diary] Mutating one thing at a time (-61)
To apply a mutation at a time, be that
- the same mutation having multiple occurrencies in the same file, or
- different mutations having each an occurrency in the same file
multiple versions of the same file should be created, with one mutation applied in each, in a different spot.
The most readable and simple approach could be something like this:
- a ClojureScript function that recursively looks through the AST for a match with a given function
- if a match is found a mutation is applied to a copy of the AST and returned
- we then proceed with the original AST, just further down the tree
The problems I see here are:
- the walking function will quickly go out of sync with the advancement of language syntax
This whole thing took me a day to realise, and I'm still unsure on how to approach details.