ast/compile: reorder body for safety differently (#4801)
Our previous approach, ordering for closures first, and taking the growing
set of output variables of the reordered body into account in a second step,
did not work out for some examples:
object.get(input.subject.roles[_], comp, [""], output)
comp = [ 1 | true ]
every y in [2] {
y in output
}
Here, the closure of `every` would have not checkout out because we've never
registered the output variable `output` -- since the first call to object.get
is unsafe without `comp`, too.
Now, the two stages have been merged. It's got surprisingly little fallout,
one test case had to be adjusted, which I believe to be a minor case, too.
Fixes the second part of #4766.
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com> S
Stephan Renatus committed
8a3bf905e451cce5da537d70dccde30e99e5ab00
Parent: 8eb21bd
Committed by GitHub <noreply@github.com>
on 6/29/2022, 6:20:15 AM