Skip to content

Commit

Permalink
BUG FIX: globalsByName() would return unexpected '...', if '..1' was …
Browse files Browse the repository at this point in the history
…requested [#92]
  • Loading branch information
HenrikBengtsson committed Mar 5, 2024
1 parent 51a7476 commit 3a75d47
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions R/globalsByName.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ globalsByName <- function(names, envir = parent.frame(), mustExist = TRUE,
debug && mdebug("- dotdotdots: <none>")
}

globals <- list()
where <- list()
globals <- structure(list(), names = character(0))
where <- structure(list(), names = character(0))
for (kk in seq_along(names)) {
name <- names[kk]
debug && mdebug("- locating #%d (%s)", kk, sQuote(name))
Expand All @@ -79,7 +79,7 @@ globalsByName <- function(names, envir = parent.frame(), mustExist = TRUE,
# stop_if_not(identical(names(globals), names))

if (length(dotdotdots) > 0L) {
for (name in c("...", dotdotdots)) {
for (name in dotdotdots) {
where[name] <- list(NULL)
ddd <- NA
if (name == "...") {
Expand All @@ -97,7 +97,10 @@ globalsByName <- function(names, envir = parent.frame(), mustExist = TRUE,
globals[[name]] <- ddd
}
}
stop_if_not(identical(names(globals), namesOrg))
stop_if_not(
length(names(globals)) == nnames,
all(names(globals) %in% namesOrg)
)

stop_if_not(
is.list(where),
Expand Down

0 comments on commit 3a75d47

Please sign in to comment.