-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PROTOTYPING: Make it possible to return globalenv() instead of emptye…
…nv() Related to HenrikBengtsson/future#515
- Loading branch information
1 parent
d1833b2
commit ad2cb3c
Showing
6 changed files
with
34 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Package: globals | ||
Version: 0.14.0-9002 | ||
Version: 0.14.0-9003 | ||
Depends: | ||
R (>= 3.1.2) | ||
Imports: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# A safe version of base::environment() that returns emptyenv() | ||
# if NULL is passed, instead of the calling environment. | ||
# Related to https://github.com/HenrikBengtsson/globals/issues/79 | ||
environment_of <- function(obj) { | ||
if (is.null(obj)) return(emptyenv()) | ||
environment_of <- function(obj, default = getOption("globals.environment_of.default", emptyenv())) { | ||
if (is.null(obj)) return(default) | ||
e <- environment(obj) | ||
if (is.null(e)) return(emptyenv()) | ||
if (is.null(e)) return(default) | ||
e | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters