Skip to content

Commit 32816fa

Browse files
committed
C#: Improve join in the InterpretedCallable characteristic predicate.
1 parent d713910 commit 32816fa

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

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

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -504,15 +504,26 @@ class UnboundCallable extends Callable {
504504
}
505505
}
506506

507+
pragma[nomagic]
508+
private predicate callableSpecInfo(Callable c, string namespace, string type, string name) {
509+
c.getDeclaringType().hasQualifiedName(namespace, type) and
510+
c.getName() = name
511+
}
512+
513+
pragma[nomagic]
514+
private predicate subtypeSpecCandidate(Callable c, UnboundValueOrRefType t) {
515+
elementSpec(_, _, true, c.getName(), _, _, t)
516+
}
517+
507518
private class InterpretedCallable extends Callable {
508519
InterpretedCallable() {
509-
exists(UnboundValueOrRefType t, boolean subtypes, string name |
510-
elementSpec(_, _, subtypes, name, _, _, t) and
511-
this.hasName(name)
512-
|
513-
this.getDeclaringType() = t
514-
or
515-
subtypes = true and
520+
exists(string namespace, string type, string name |
521+
callableSpecInfo(this, namespace, type, name) and
522+
elementSpec(namespace, type, _, name, _, _)
523+
)
524+
or
525+
exists(UnboundValueOrRefType t |
526+
subtypeSpecCandidate(this, t) and
516527
this.getDeclaringType() = t.getASubTypeUnbound+()
517528
)
518529
}

0 commit comments

Comments
 (0)