mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
C#: Fix join-order in UselessUpcast.ql
This commit is contained in:
@@ -86,16 +86,21 @@ class ExplicitUpcast extends ExplicitCast {
|
|||||||
src != dest // Handled by `cs/useless-cast-to-self`
|
src != dest // Handled by `cs/useless-cast-to-self`
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this upcast is the argument of a call to `target`. */
|
pragma[nomagic]
|
||||||
private predicate isArgument(Call c, Callable target) {
|
private predicate isArgument(Type t) {
|
||||||
exists(Parameter p |
|
exists(Parameter p |
|
||||||
this = p.getAnAssignedArgument() and
|
this = p.getAnAssignedArgument() and
|
||||||
p.getType() = this.getType() and
|
t = p.getType()
|
||||||
c.getAnArgument() = this and
|
|
||||||
target = c.getTarget()
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Holds if this upcast is the argument of a call to `target`. */
|
||||||
|
private predicate isArgument(Call c, Callable target) {
|
||||||
|
this.isArgument(this.getType()) and
|
||||||
|
c.getAnArgument() = this and
|
||||||
|
target = c.getTarget()
|
||||||
|
}
|
||||||
|
|
||||||
/** Holds if this upcast may be used to disambiguate the target of an instance call. */
|
/** Holds if this upcast may be used to disambiguate the target of an instance call. */
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate isDisambiguatingInstanceCall(InstanceCallable other, int args) {
|
private predicate isDisambiguatingInstanceCall(InstanceCallable other, int args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user