Skip to content

Commit

Permalink
Fix bug in make_register() #22
Browse files Browse the repository at this point in the history
  • Loading branch information
kinto-b committed Nov 9, 2021
1 parent 47c64f1 commit 3b63478
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# makepipe (development version)

* Fixed a minor bug in `make_register()` (#22). Previously, an error would be thrown
when using `make_register()` outside of a `makepipe` segment if the user set
`quiet=TRUE`. This is no longer the case.

# makepipe 0.0.5

* Fixed minor bug having to do with the propagation of out-of-dateness in
Expand Down
16 changes: 7 additions & 9 deletions R/make_register.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@
#' step_one$result$chk
#' }
make_register <- function(value, name, quiet = FALSE) {
if (!quiet) {
msg <- "`make_register()` called outside of a 'makepipe' pipeline"
if (exists("__makepipe_register__", parent.frame())) {
register_env <- get("__makepipe_register__", parent.frame())
if (!is.environment(register_env)) warning(msg, call. = FALSE)
} else {
warning(msg, call. = FALSE)
return(invisible(value))
}
msg <- "`make_register()` called outside of a 'makepipe' pipeline"
if (exists("__makepipe_register__", parent.frame())) {
register_env <- get("__makepipe_register__", parent.frame())
if (!is.environment(register_env) & !quiet) warning(msg, call. = FALSE)
} else {
if (!quiet) warning(msg, call. = FALSE)
return(invisible(value))
}

assign(name, value, register_env)
Expand Down

0 comments on commit 3b63478

Please sign in to comment.