Skip to content

Commit

Permalink
Use deparse() directly to avoid tiny overhead & make it easier to fin…
Browse files Browse the repository at this point in the history
…d deparse1() calls later
  • Loading branch information
MichaelChirico committed Mar 28, 2024
1 parent a30078a commit 919c262
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ replace_dot_alias = function(e) {

# What's the name of the top-level call in 'j'?
# NB: earlier, we used 'as.character()' but that fails for closures/builtins (#6026).
root_name = function(jsub) if (is.call(jsub)) paste(format(jsub[[1L]]), collapse = " ") else ""
root_name = function(jsub) if (is.call(jsub)) paste(deparse(jsub[[1L]]), collapse = " ") else ""

DT = function(x, ...) { #4872
old = getOption("datatable.optimize")
Expand Down
2 changes: 1 addition & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ is_utc = function(tz) {
"%iscall%" = function(e, f) {
if (!is.call(e)) return(FALSE)
if (is.name(e1 <- e[[1L]])) return(e1 %chin% f)
paste(format(e1), collapse = " ") %chin% f # complicated cases e.g. a closure/builtin on LHS of call; note that format() is much (e.g. 40x) slower than as.character()
paste(deparse(e1), collapse = " ") %chin% f # complicated cases e.g. a closure/builtin on LHS of call; note that format() is much (e.g. 40x) slower than as.character()
}

# nocov start #593 always return a data.table
Expand Down

0 comments on commit 919c262

Please sign in to comment.