Skip to content

Commit 231100a

Browse files
Apply suggestions from code review
Co-authored-by: Davis Vaughan <[email protected]>
1 parent c19a5fa commit 231100a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

crates/ark/src/modules/positron/hooks_source.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ make_ark_source <- function(original_source) {
3838
# fallback calls.
3939
use_file <- missing(exprs)
4040

41-
# Capture environment early if local evaluation is requested
41+
# Capture environment early if local evaluation is requested.
42+
# This is necessary if we have to fallback when `local = TRUE`.
4243
if (isTRUE(local)) {
4344
local <- parent.frame()
4445
}
@@ -102,10 +103,7 @@ make_ark_source <- function(original_source) {
102103
}
103104

104105
env <- if (isTRUE(local)) {
105-
# That would be very unexpected since we captured the local
106-
# environment in `local` when set to `TRUE`. But just for peace of
107-
# mind we handle it here.
108-
parent.frame()
106+
stop("Internal error: `local = TRUE` should have been converted to an environment above.")
109107
} else if (isFALSE(local)) {
110108
.GlobalEnv
111109
} else if (is.environment(local)) {

0 commit comments

Comments
 (0)