Skip to content

Commit

Permalink
More checking of params to create_loop()
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Feb 13, 2020
1 parent 60b2dd0 commit 3443ee7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion R/later.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,20 @@ create_loop <- function(parent = current_loop(), autorun = NULL) {
id <- .globals$next_id
.globals$next_id <- id + 1L

if (!is.null(autorun) && autorun == FALSE) {
if (!is.null(autorun)) {
# This is for backward compatibility, if `create_loop(autorun=FALSE)` is called.
parent <- NULL
warning("create_loop(autorun=FALSE) is deprecated. Please use create_loop(parent=NULL) from now on.")
}
if (identical(parent, FALSE)) {
# This is for backward compatibility, if `create_loop(FALSE)` is called.
# (Previously the first and only parameter was `autorun`.)
parent <- NULL
warning("create_loop(FALSE) is deprecated. Please use create_loop(parent=NULL) from now on.")
}
if (!is.null(parent) && !inherits(parent, "event_loop")) {
stop("`parent` must be NULL or an event_loop object.")
}

if (is.null(parent)) {
parent_id <- -1L
Expand Down

0 comments on commit 3443ee7

Please sign in to comment.