Skip to content

Commit f190d60

Browse files
committed
C#: Make it possible to describe flow for properties using their backing methods.
1 parent 37644d3 commit f190d60

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ private import internal.DataFlowPublic
7878
private import internal.FlowSummaryImpl::Public
7979
private import internal.FlowSummaryImpl::Private::External
8080
private import internal.FlowSummaryImplSpecific
81+
private import semmle.code.csharp.dispatch.OverridableCallable
8182

8283
/**
8384
* A module importing the frameworks that provide external flow data,
@@ -347,12 +348,15 @@ private class UnboundValueOrRefType extends ValueOrRefType {
347348
}
348349
}
349350

350-
private class UnboundCallable extends Callable, Virtualizable {
351+
private class UnboundCallable extends Callable {
351352
UnboundCallable() { this.isUnboundDeclaration() }
352353

353354
predicate overridesOrImplementsUnbound(UnboundCallable that) {
354355
exists(Callable c |
355-
this.overridesOrImplementsOrEquals(c) and
356+
this.(Virtualizable).overridesOrImplementsOrEquals(c) or
357+
this = c.(OverridableCallable).getAnUltimateImplementor() or
358+
this = c.(OverridableCallable).getAnOverrider+()
359+
|
356360
this != c and
357361
that = c.getUnboundDeclaration()
358362
)
@@ -409,7 +413,7 @@ private Element interpretElement0(
409413
string namespace, string type, boolean subtypes, string name, string signature
410414
) {
411415
exists(UnboundValueOrRefType t | elementSpec(namespace, type, subtypes, name, signature, _, t) |
412-
exists(Member m |
416+
exists(Declaration m |
413417
(
414418
result = m
415419
or

0 commit comments

Comments
 (0)