Code-Inspect / flowr

A program slicer and dataflow analyzer for the R programming language.
https://github.com/Code-Inspect/flowr/wiki
GNU General Public License v3.0
14 stars 2 forks source link

Assignment in every branch still reconstructs original assignment #802

Closed Ellpeck closed 1 month ago

Ellpeck commented 1 month ago
x <- 1
if(x) {
  if(y) {
    x <- 3
  } else {
    x <- 2
  }
} else {
  x <- 4
}
print(x)

results in the first line (x <- 1) still being part of the slice, even though x is overwritten in every branch.

EagleoutIce commented 1 month ago

On a second look, this is the fault of the piece of code. the first condition if(x) causes x <- 1 to be included. Please re-insert the test as a part of #800, but modify the condition accordingly @Ellpeck.