Debian Codegraph @

R/compat-lifecycle.R

raw
1 # nocov start - compat-lifecycle (last updated: rlang 0.3.0.9000)
2
3 scoped_lifecycle_silence <- function(frame = rlang::caller_env()) {
4 rlang::local_options(
5 .frame = frame,
6 lifecycle_verbosity = "quiet"
7 )
8 }
9 with_lifecycle_silence <- function(expr) {
10 scoped_lifecycle_silence()
11 expr
12 }
13
14 scoped_lifecycle_warnings <- function(frame = rlang::caller_env()) {
15 rlang::local_options(
16 .frame = frame,
17 lifecycle_verbosity = "warning"
18 )
19 }
20 with_lifecycle_warnings <- function(expr) {
21 scoped_lifecycle_warnings()
22 expr
23 }
24
25 scoped_lifecycle_errors <- function(frame = rlang::caller_env()) {
26 rlang::local_options(
27 .frame = frame,
28 lifecycle_verbosity = "error"
29 )
30 }
31 with_lifecycle_errors <- function(expr) {
32 scoped_lifecycle_errors()
33 expr
34 }
35
36 # Enable once signal_superseded() reaches stable state
37 signal_superseded <- function(...) {}
38
39 foreign_caller_env <- function(my_env = ns_env()) {
40 for (n in 2:10) {
41 caller <- caller_env(n)
42 if (!is_reference(env_parent(caller), my_env)) {
43 return(caller)
44 }
45 }
46
47 # Safety net
48 caller
49 }
50
51 # nocov end