You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now write_mutated_pkg makes completely new R files, and writes the mutated fxns into those files. Maybe copy over R files from original location, and use line number/column position to replace lines - so that roxygen tags/constants/etc are retained as those things could affect outcomes
The text was updated successfully, but these errors were encountered:
this is complicated. the way R parses functions, it doesn't maintain the same number of lines, e.g.,
remotes::install_github("ropenscilabs/astr")
library(astr)
foo<-function(x=NULL) {
if (!is.null(x)) x*10return(x)
}
w= ast_decompose(foo)
fun= ast_recompose(w)
cat(fun)
#> function (x = NULL)#> {#> if (!is.null(x))#> x * 10#> return(x)#> }
In this example, the if statement is all on one line, which isn't that uncommon. So the recomposed function adds an additional line, with the if statement over 2 lines.
If we wanted to re-insert mutated functions into the original file structure they were pulled from, we'd need to account for these additional lines and push any further lines down.
Right now
write_mutated_pkg
makes completely new R files, and writes the mutated fxns into those files. Maybe copy over R files from original location, and use line number/column position to replace lines - so that roxygen tags/constants/etc are retained as those things could affect outcomesThe text was updated successfully, but these errors were encountered: