From e61590129204c23f82065995b8121e15a29e12e1 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Wed, 21 Aug 2024 11:30:26 -0500 Subject: [PATCH] Clarify context() call implementation --- R/conditions.R | 2 +- R/evaluate.R | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/conditions.R b/R/conditions.R index 00e5b63..5ef8b5c 100644 --- a/R/conditions.R +++ b/R/conditions.R @@ -54,7 +54,7 @@ sanitize_call <- function(cnd) { if (identical(cnd$call, quote(withVisible(do)))) { cnd$call <- NULL } - if (identical(cnd$call, quote(eval(as.call(list(context)), envir)))) { + if (identical(cnd$call, quote(eval(substitute(context()), envir)))) { cnd$call <- NULL } diff --git a/R/evaluate.R b/R/evaluate.R index 6f1f8d5..783675e 100644 --- a/R/evaluate.R +++ b/R/evaluate.R @@ -170,9 +170,9 @@ evaluate <- function(input, } } - # Here we use `eval()` to create an unwinding scope for `envir`. - # We call ourselves back immediately once the scope is created. - eval(as.call(list(context)), envir) + # Here we use `eval()` to create an unwinding scope for `envir`, using + # an inlined call to `context()`. + eval(substitute(context()), envir) watcher$capture_output() # Always capture last plot, even if incomplete