Skip to content

Commit

Permalink
Clarify context() call implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Aug 21, 2024
1 parent cc9f3d2 commit e615901
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/conditions.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions R/evaluate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e615901

Please sign in to comment.