Skip to content

Commit 4dfc105

Browse files
committed
Use quosure accessors
1 parent ac8daf7 commit 4dfc105

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

R/expect-invisible.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#' out <- expect_invisible(greet("Hadley"))
2222
#' expect_equal(out, "Hadley")
2323
expect_invisible <- function(call, label = NULL) {
24-
lab <- label %||% expr_label(get_expr(enquo(call)))
24+
lab <- label %||% expr_label(enexpr(call))
2525
vis <- withVisible(call)
2626

2727
expect(
@@ -34,7 +34,7 @@ expect_invisible <- function(call, label = NULL) {
3434
#' @export
3535
#' @rdname expect_invisible
3636
expect_visible <- function(call, label = NULL) {
37-
lab <- label %||% expr_label(get_expr(enquo(call)))
37+
lab <- label %||% expr_label(enexpr(call))
3838
vis <- withVisible(call)
3939

4040
expect(

R/quasi-label.R

+5-3
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,18 @@ quasi_label <- function(quo, label = NULL, arg = "quo") {
4040
stop("argument `", arg, "` is missing, with no default.", call. = FALSE)
4141
}
4242

43+
expr <- quo_get_expr(quo)
44+
4345
list(
44-
val = eval_bare(get_expr(quo), get_env(quo)),
45-
lab = label %||% expr_label(get_expr(quo))
46+
val = eval_bare(expr, quo_get_env(quo)),
47+
lab = label %||% expr_label(expr)
4648
)
4749
}
4850

4951
quasi_capture <- function(.quo, .label, .capture, ...) {
5052
act <- list()
5153
act$lab <- .label %||% quo_label(.quo)
52-
act$cap <- .capture(act$val <- eval_bare(get_expr(.quo), get_env(.quo)), ...)
54+
act$cap <- .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), ...)
5355

5456
act
5557
}

R/verify-output.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
verify_output <- function(path, code, width = 80, crayon = FALSE) {
2929
code <- enquo(code)
3030

31-
env <- get_env(code)
32-
expr <- get_expr(code)
31+
env <- quo_get_env(code)
32+
expr <- quo_get_expr(code)
3333

3434
if (is_call(expr, "{")) {
3535
exprs <- as.list(expr[-1])

0 commit comments

Comments
 (0)