Ruby: Content flow through captured variables #10844
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were previously supporting direct flow through captured variables:
However, we were not supporting flow through contents (e.g. fields) on captured variables:
Luckily, the existing SSA library provides the bits that we need to also cover the cases above:
each
already gives rise to an implicit read ofc
, so instead of limiting flow in to be the SSA definition for the implicit read, we do like with normal SSA flow and consider all adjacent accesses (reads or the definition itself) to flow in (that is, it is no longerx = C.new
that flows in, but instead the post-update node forx
inx.set_field(taint1)
).each
already gives rise to an implicit read ofc
, so we simply need to add flow from the post-update ofy
iny.set_field(taint2)
to all adjacent reads/phi nodes that immediately follow the implicit read at the call toeach
.