rstudio/rstudio

debugSource() throws a warning when getOption("keep.source") is FALSE

Open

#12.375 aperta il 25 nov 2022

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)Java (1060 fork)batch import
buggood first issue

Metriche repository

Star
 (4384 star)
Metriche merge PR
 (Merge medio 14h 15m) (202 PR mergiate in 30 g)

Descrizione

debugSource() throws a warning when options(keep.source = FALSE):

> debugSource(this.path())

> LINENO()
[1] NA
Warning message:
In structure(c(refs[[1]][1], refs[[1]][2], refs[[lastref]][3], refs[[lastref]][[4]],  :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.
> 

I think this is easily fixed in .rs.makeSourceEquivFunction(), right after refs <- attr(content, "srcref"), by adding something like:

    if (is.null(srcref))
        return(fun)

I'm not sure if this has any further implications for other functions in RStudio, but I'd imagine something similar could be added to those as well. Thank you!

Guida contributor