File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -225,14 +225,29 @@ preceding access path. It takes the same specifiers as `WithElement` and
225225` Element ` . It is only valid in an input path.
226226
227227This component has the effect of excluding the relevant elements when copying
228- from input to output. For example in the following summary:
228+ from input to output. It is useful for modelling methods that remove elements
229+ from a collection. For example to model a method that removes the first element
230+ from the receiver, we can do so like this:
229231
230232``` ql
231- input = "Argument[0].WithoutElement[0]" and
232- output = "ReturnValue"
233+ input = "Argument[self].WithoutElement[0]" and
234+ output = "Argument[self]"
235+ ```
236+
237+ Note that both the input and output refer to the receiver. The effect of this
238+ summary is that use-use flow between the receiver in the method call and a
239+ subsequent use of the same receiver will be blocked:
240+
241+ ``` ruby
242+ a[0 ] = source 0
243+ a[1 ] = source 1
244+
245+ a.remove_first # use-use flow from `a` on this line to `a` below will be blocked.
246+ # there will still be flow from `[post-update] a` to `a` below.
247+
248+ sink a[0 ]
249+ sink a[1 ] # $ hasValueFlow=1
233250```
234251
235- any data in any index of the first argument will be copied to the return value,
236- with the exception of data at index 0.
237252
238253[ ^ 1 ] : I've chosen this name to avoid overloading the word "argument".
You can’t perform that action at this time.
0 commit comments