mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Swift: Fix test by including the 'allowParameterReturnInSelf' hook from the variable capture library.
This commit is contained in:
@@ -1387,7 +1387,12 @@ predicate additionalLambdaFlowStep(Node nodeFrom, Node nodeTo, boolean preserves
|
||||
* One example would be to allow flow like `p.foo = p.bar;`, which is disallowed
|
||||
* by default as a heuristic.
|
||||
*/
|
||||
predicate allowParameterReturnInSelf(ParameterNode p) { none() }
|
||||
predicate allowParameterReturnInSelf(ParameterNode p) {
|
||||
exists(Callable c |
|
||||
c = p.(ParameterNodeImpl).getEnclosingCallable().asSourceCallable() and
|
||||
CaptureFlow::heuristicAllowInstanceParameterReturnInSelf(c)
|
||||
)
|
||||
}
|
||||
|
||||
/** An approximated `Content`. */
|
||||
class ContentApprox = Unit;
|
||||
|
||||
@@ -187,5 +187,5 @@ func multi() {
|
||||
var y = source("multi", 1)
|
||||
var f = { () in x = y }
|
||||
f()
|
||||
sink(x) // $ MISSING: hasValueFlow=multi
|
||||
sink(x) // $ hasValueFlow=multi
|
||||
}
|
||||
Reference in New Issue
Block a user