@@ -42,7 +42,7 @@ cnd_bullet_rowwise_unlist <- function() {
4242 if (peek_mask()$ is_rowwise()) {
4343 glue_data(
4444 peek_error_context(),
45- " Did you mean: `{error_name} = list({quo_as_label(error_quo )})` ?"
45+ " Did you mean: `{error_name} = list({expr_as_label(error_expr )})` ?"
4646 )
4747 }
4848}
@@ -66,8 +66,7 @@ is_data_pronoun <- function(x) {
6666}
6767
6868# Because as_label() strips off .data$<> and .data[[<>]]
69- quo_as_label <- function (quo ) {
70- expr <- quo_get_expr(quo )
69+ expr_as_label <- function (expr ) {
7170 if (is_data_pronoun(expr )) {
7271 deparse(expr )[[1 ]]
7372 } else {
@@ -87,15 +86,17 @@ new_error_context <- function(dots, i, mask) {
8786 if (! length(dots ) || i == 0L ) {
8887 env(
8988 error_name = " " ,
90- error_quo = NULL ,
89+ error_expr = NULL ,
9190 mask = mask
9291 )
9392 } else {
94- # Saving the quosure rather than the result of `quo_as_label()` to avoid
95- # slow label creation unless required
93+ # Saving the expression rather than the result of `expr_as_label()` to avoid
94+ # slow label creation unless required. Not saving the quosure itself because
95+ # carrying around its environment past the scope of a dplyr verb's lifetime
96+ # can be very expensive (#7649)!
9697 env(
9798 error_name = names(dots )[[i ]],
98- error_quo = dots [[i ]],
99+ error_expr = quo_get_expr( dots [[i ]]) ,
99100 mask = mask
100101 )
101102 }
@@ -120,24 +121,24 @@ mask_type <- function(mask = peek_mask()) {
120121}
121122
122123ctxt_error_label <- function (ctxt = peek_error_context()) {
123- error_label(ctxt $ error_name , ctxt $ error_quo )
124+ error_label(ctxt $ error_name , ctxt $ error_expr )
124125}
125- error_label <- function (name , quo ) {
126+ error_label <- function (name , expr ) {
126127 if (is_null(name ) || ! nzchar(name )) {
127- quo_as_label( quo )
128+ expr_as_label( expr )
128129 } else {
129130 name
130131 }
131132}
132133
133134ctxt_error_label_named <- function (ctxt = peek_error_context()) {
134- error_label_named(ctxt $ error_name , ctxt $ error_quo )
135+ error_label_named(ctxt $ error_name , ctxt $ error_expr )
135136}
136- error_label_named <- function (name , quo ) {
137+ error_label_named <- function (name , expr ) {
137138 if (is_null(name ) || ! nzchar(name )) {
138- quo_as_label( quo )
139+ expr_as_label( expr )
139140 } else {
140- paste0(name , " = " , quo_as_label( quo ))
141+ paste0(name , " = " , expr_as_label( expr ))
141142 }
142143}
143144
@@ -379,7 +380,7 @@ new_dplyr_warning <- function(data) {
379380 group_label <- " "
380381 }
381382
382- label <- error_label_named(data $ name , data $ quo )
383+ label <- error_label_named(data $ name , data $ expr )
383384
384385 msg <- c(
385386 " i" = glue :: glue(" In argument: `{label}`." ),
0 commit comments