From 46478b522b3750bfc6da0f039ddc64361088e15c Mon Sep 17 00:00:00 2001 From: Hiroaki Yutani Date: Wed, 30 Oct 2019 01:20:24 +0900 Subject: [PATCH] Handle a quosure properly. Closes #3552 --- R/aes-calculated.r | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/R/aes-calculated.r b/R/aes-calculated.r index 95b9390bba..918854c390 100644 --- a/R/aes-calculated.r +++ b/R/aes-calculated.r @@ -42,6 +42,8 @@ is_calculated <- function(x) { FALSE } else if (is.symbol(x)) { is_dotted_var(as.character(x)) + } else if (is_quosure(x)) { + is_calculated(quo_get_expr(x)) } else if (is.call(x)) { if (identical(x[[1]], quote(stat))) { TRUE @@ -66,6 +68,12 @@ strip_dots <- function(expr) { } else { expr } + } else if (is_quosure(expr)) { + # strip dots from quosure and reconstruct the quosure + expr <- new_quosure( + strip_dots(quo_get_expr(expr)), + quo_get_env(expr) + ) } else if (is.call(expr)) { if (identical(expr[[1]], quote(stat))) { strip_dots(expr[[2]])