Skip to content

Commit 06b77eb

Browse files
committed
C#: Re-introduce callableFlow for Add as the test test/query-tests/Language Abuse/ForeachCapture/ForeachCapture.qlref needs to be re-written before it can be removed.
1 parent d3f2894 commit 06b77eb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,25 @@ class SystemTextStringBuilderFlow extends LibraryTypeDataFlow, SystemTextStringB
478478
class IEnumerableFlow extends LibraryTypeDataFlow, RefType {
479479
IEnumerableFlow() { this.getABaseType*() instanceof SystemCollectionsIEnumerableInterface }
480480

481+
override predicate callableFlow(
482+
CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp,
483+
SourceDeclarationCallable c, boolean preservesValue
484+
) {
485+
preservesValue = true and
486+
exists(string name, int arity |
487+
arity = c.getNumberOfParameters() and
488+
c = this.getAMethod() and
489+
c.getUndecoratedName() = name
490+
|
491+
name = "Add" and
492+
arity = 1 and
493+
source = TCallableFlowSourceArg(0) and
494+
sourceAp = AccessPath::empty() and
495+
sink instanceof CallableFlowSinkQualifier and
496+
sinkAp = AccessPath::element()
497+
)
498+
}
499+
481500
override predicate clearsContent(
482501
CallableFlowSource source, Content content, SourceDeclarationCallable callable
483502
) {

0 commit comments

Comments
 (0)