Skip to content

Commit

Permalink
Resolve #2727
Browse files Browse the repository at this point in the history
This commit implements the change @hadley proposed at #2727 (comment) to the internal function `needs_tweak()`. This does resolve the small reproducible example I described, though I ignore if there are other situations where it wouldn't work for.
  • Loading branch information
lcolladotor committed Jul 18, 2024
1 parent 2841c0f commit 3a92bc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/usage.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ as_data.tag_usage <- function(x, ...) {
lines <- strsplit(text, "\n", fixed = TRUE)[[1]]
parsed <- lapply(lines, function(x) tryCatch(parse(text = x)[[1]], error = function(e) NULL))
needs_tweak <- function(x) {
is_call(x) && !is_call(x, "=") && !is_syntactic(x[[1]])
is_call(x) && !is_call(x, "=") && (is_symbol(x[[1]]) && !is_syntactic(x[[1]]))
}
to_tweak <- vapply(parsed, needs_tweak, logical(1))
lines[to_tweak] <- vapply(parsed[to_tweak], deparse1, character(1))
Expand Down

0 comments on commit 3a92bc7

Please sign in to comment.