Skip to content

Commit

Permalink
use internal functions find_globals() and find_locals() in xfun 0.44
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed May 15, 2024
1 parent da8b5e2 commit ecaf49e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: knitr
Type: Package
Title: A General-Purpose Package for Dynamic Report Generation in R
Version: 1.46.3
Version: 1.46.4
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person("Abhraneel", "Sarma", role = "ctb"),
Expand Down
4 changes: 2 additions & 2 deletions R/block.R
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ eng_r = function(options) {
obj.new = if (is.null(options$cache.vars)) setdiff(ls(globalenv(), all.names = TRUE), obj.before)
copy_env(globalenv(), env, obj.new)
objs = if (isFALSE(ev) || length(code) == 0) character(0) else
options$cache.vars %n% codetools::findLocalsList(parse_only(code))
options$cache.vars %n% xfun:::find_locals(code)
# make sure all objects to be saved exist in env
objs = intersect(c(objs, obj.new), ls(env, all.names = TRUE))
if (options$autodep) {
Expand Down Expand Up @@ -368,7 +368,7 @@ purge_cache = function(options) {

cache_globals = function(option, code) {
if (is.character(option)) option else {
(if (isFALSE(option)) find_symbols else xfun:::find_globals)(code)
if (isFALSE(option)) find_symbols(code) else xfun:::find_globals(code, knit_global())
}
}

Expand Down

0 comments on commit ecaf49e

Please sign in to comment.