Closed DavisVaughan closed 1 year ago
I suppose you can manually merge the srcref
list, but I'm not sure what you'd do with $wholeSrcref
here
attributes(parse(text = "foo(); bar"))
#> $srcref
#> $srcref[[1]]
#> foo()
#>
#> $srcref[[2]]
#> bar
#>
#>
#> $srcfile
#> <text>
#>
#> $wholeSrcref
#> foo(); bar
attributes(parse(text = "baz"))
#> $srcref
#> $srcref[[1]]
#> baz
#>
#>
#> $srcfile
#> <text>
#>
#> $wholeSrcref
#> baz
hmm I think this attribute is not required.
Closes #1603
It turns out that in both rlang 1.0.6 and 1.1.0, source information was already being dropped in all cases (I wanted to ensure that removing usage of
flatten()
was not the result of this change, and it doesn't seem to be).I think this makes sense as the source reference information is typically attached to the expression object, and:
parse_expr()
returns the individual expression element, not the expression vectorparse_exprs()
can parse and flatten multiple expressions, and since each expression can return >1 element fromparse()
, you don't have a good 1:1 mapping between the source information and the flattened parsed expressions, so it makes sense to just drop the source information here too