Skip to content

Commit 2d5d9ca

Browse files
Revert "implement for bug"
This reverts commit c5e1284.
1 parent f6996b2 commit 2d5d9ca

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

R/cedta.R

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ cedta.pkgEvalsUserCode = c("gWidgetsWWW","statET","FastRWeb","slidify","rmarkdow
2828

2929
# nocov start: very hard to reach this within our test suite -- the call stack within a call generated by e.g. knitr
3030
# for loop, not any(vapply_1b(.)), to allow early exit
31-
.any_eval_calls_in_stack = function(calls) {
31+
.any_eval_calls_in_stack = function() {
32+
calls = sys.calls()
3233
# likelier to be close to the end of the call stack, right?
3334
for (ii in length(calls):1) { # nolint: seq_linter. rev(seq_len(length(calls)))? See https://bugs.r-project.org/show_bug.cgi?id=18406.
3435
the_call = calls[[ii]][[1L]]
@@ -38,17 +39,6 @@ cedta.pkgEvalsUserCode = c("gWidgetsWWW","statET","FastRWeb","slidify","rmarkdow
3839
}
3940
# nocov end
4041

41-
.any_sd_queries_in_stack = function(calls) {
42-
for (ii in length(calls):1) { # nolint: seq_linter. As above.
43-
the_call = calls[[ii]][1L]
44-
if (!is.name(the_call) || the_call != "[") next
45-
the_lhs = calls[[ii]][[2L]]
46-
if (!is.name(the_lhs) || the_lhs != ".SD") next
47-
return(TRUE)
48-
}
49-
FALSE
50-
}
51-
5242
# in a helper to promote readability
5343
# NB: put the most common and recommended cases first for speed
5444
.cedta_impl_ <- function(ns, n) {
@@ -57,21 +47,17 @@ cedta.pkgEvalsUserCode = c("gWidgetsWWW","statET","FastRWeb","slidify","rmarkdow
5747

5848
if ("data.table" %chin% names(getNamespaceImports(ns))) return(TRUE)
5949

60-
sc <- sys.calls()
6150
if (nsname == "utils") {
6251
if (exists("debugger.look", parent.frame(n+1L))) return(TRUE)
6352

6453
# 'example' for #2972
54+
sc <- sys.calls()
6555
if (length(sc) >= 8L && sc[[length(sc) - 7L]] %iscall% 'example') return(TRUE)
6656
}
6757

68-
if (nsname == "base") {
69-
if (all(c("FUN", "X") %chin% ls(parent.frame(n)))) return(TRUE) # lapply
70-
71-
if (.any_sd_queries_in_stack(sc)) return(TRUE) # e.g. lapply() where "piped-in" j= arg has .SD[]
72-
}
58+
if (nsname == "base" && all(c("FUN", "X") %chin% ls(parent.frame(n)))) return(TRUE) # lapply
7359

74-
if (nsname %chin% cedta.pkgEvalsUserCode && .any_eval_calls_in_stack(sc)) return(TRUE)
60+
if (nsname %chin% cedta.pkgEvalsUserCode && .any_eval_calls_in_stack()) return(TRUE)
7561

7662
if (nsname %chin% cedta.override) return(TRUE)
7763

0 commit comments

Comments
 (0)