if (rlang::is_installed("data.tree")) {
withr::with_options(
list(styler.cache_name = NULL), # temporarily deactivate cache
{
code <- "a <- function(x) { if(x > 1) { 1+1 } else {x} }"
nested_pd <- compute_parse_data_nested(code)
initialized <- styler:::pre_visit_one(
nested_pd, default_style_guide_attributes
)
styler:::create_node_from_nested_root(initialized,
structure_only = FALSE
)
}
)
}
Run the code above in your browser using DataLab