Skip to content

Commit

Permalink
Improve performance (#172)
Browse files Browse the repository at this point in the history
Part of #167
  • Loading branch information
hadley authored Nov 2, 2023
1 parent b4e5da3 commit da5e39b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# lifecycle (development version)

* Switch from `expr_deparse()` to `deparse()`. This improves performance
considerably and the cost of making some unusual function calls mildly
less appealing (#167).

# lifecycle 1.0.3

* The `with` line is now an info bullet. The `details` lines are info
Expand Down
4 changes: 2 additions & 2 deletions R/spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ spec_fn <- function(call, ctxt) {
}

# Deparse so non-syntactic names are backticked
expr_deparse(fn)
deparse(fn)
}

spec_arg <- function(call, ctxt) {
Expand Down Expand Up @@ -118,7 +118,7 @@ spec_reason <- function(call, ctxt) {
return(node_car(arg))
}

fn <- expr_deparse(node_car(call))
fn <- deparse(node_car(call))
cli::cli_abort(
c(
"{.arg what} must contain reason as a string on the RHS of `=`.",
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/deprecate.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@
Code
cat_line(lifecycle_message("1.0.0", "`foo-fy`(`qu-ux` = )"))
Output
The `qu-ux` argument of `foo-fy` is deprecated as of base 1.0.0.
The `qu-ux` argument of `foo-fy()` is deprecated as of base 1.0.0.
Code
cat_line(lifecycle_message("1.0.0", "`foo<-`()"))
Output
`foo<-` was deprecated in base 1.0.0.
`foo<-()` was deprecated in base 1.0.0.
Code
cat_line(lifecycle_message("1.0.0", "`+`()"))
Output
`+` was deprecated in base 1.0.0.
`+()` was deprecated in base 1.0.0.

# details uses an info bullet by default

Expand Down

0 comments on commit da5e39b

Please sign in to comment.