Fix kill set construction for RHSs which can branch
Related to short-circuiting, this shouldn't always kill the previous declarations, since it might be context-dependent on whether it gets updated or not in assignment expressions:
function void f(int<64> i) {
local x = "bad";
local x2 = (i == 10) || ((x = "good") == "good");
hilti::print(x);
}
Depending on i, x may end up as good or bad. It looks like x = "bad" is added to the kill set after x2, which would be wrong. Happy to punt that for later, but just pointing it out
Originally posted by @evantypanski in https://github.com/zeek/spicy/pull/2126#discussion_r2240205405
There's something hidden here: || and && are not really best thought of as expressions - they are control flow. If we just modeled them within the CFG as control flow (ie || expression has a branching path) then this issue is solved with current infrastructure
Each expression may then still correspond to a given CFG node that is its closest parent, even if the entire expression itself has multiple control flow nodes.
Then we don't need any special handling for assignment expressions or anything - || will just create a branching path in the CFG like an if (well, because it is an if)