-
Notifications
You must be signed in to change notification settings - Fork 237
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior
Description
in one of the R files I have something like this, that defines a temporary function in order to define a static variable:
f<- function(){
.a<- 0
function(x=1){
.a<<- .a + x
.a
}
}
f2<- f()
rm(f)
When running roxygenise on this I get the error:
Error in eval(expr, envir, enclos) : object 'f' not found
If on removes the call to rm, there is no error.
> traceback()
12: eval(expr, envir, enclos)
11: eval(assignee, env)
10: parser(call, env)
9: FUN(X[[1L]], ...)
8: lapply(src_refs, parse.srcref, env = env)
7: force(code)
6: parse_cache$compute(c(env_hash, readLines(file, warn = FALSE)),
{
src_refs <- attributes(parse(srcfile$filename, srcfile = srcfile))$srcref
pre_refs <- prerefs(srcfile, src_refs)
if (length(src_refs) == 0)
return(list())
src_parsed <- lapply(src_refs, parse.srcref, env = env)
pre_parsed <- lapply(pre_refs, parse.preref)
stopifnot(length(src_parsed) == length(pre_parsed))
mapply(c, src_parsed, pre_parsed, SIMPLIFY = FALSE)
})
5: FUN("/home/renaud/Documents/tmp/test/R/fun.R"[[1L]],
...)
4: lapply(paths, parse.file, env = env, env_hash = env_hash)
3: unlist(lapply(paths, parse.file, env = env, env_hash = env_hash),
recursive = FALSE)
2: parse.files(r_files)
1: roxygenise(".")
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behavior