qri-io / qri

you're invited to a data party!
https://qri.io
GNU General Public License v3.0
1.1k stars 66 forks source link

feat(transform): Analyze `if` statements by unioning each branch #1995

Closed dustmop closed 2 years ago

dustmop commented 2 years ago

In dataflow analysis, each branch of an if statement is analyzed separately. Then, the environments from those branches are merged together, since assignments from either one can influence bindings. Furthermore, variables in the conditional itself influences the values of assignments within those branches.

First commit adds a join field to if statements, which indicates where the two branches join up. This make it much easier to recursively analyze each branch of the control structure.