Merge pull request #666 from hvitved/csharp/useless-upcast-performance

C#: Improve performance of `cs/useless-upcast`
This commit is contained in:
calumgrant
2018-12-13 12:04:12 +00:00
committed by GitHub

View File

@@ -118,8 +118,9 @@ class ExplicitUpcast extends ExplicitCast {
}
pragma [nomagic]
private predicate isDisambiguatingStaticCall0(StaticCall c, StaticCallable target, ValueOrRefType t) {
private predicate isDisambiguatingStaticCall0(StaticCall c, StaticCallable target, string name, ValueOrRefType t) {
this.isArgument(c, target) and
name = target.getName() and
(
t = c.(QualifiableExpr).getQualifier().getType()
or
@@ -131,9 +132,9 @@ class ExplicitUpcast extends ExplicitCast {
/** Holds if this upcast may be used to disambiguate the target of a static call. */
pragma [nomagic]
private predicate isDisambiguatingStaticCall(StaticCallable other, int args) {
exists(StaticCall c, StaticCallable target, ValueOrRefType t |
this.isDisambiguatingStaticCall0(c, target, t) |
hasStaticCallable(t, other, target.getName()) and
exists(StaticCall c, StaticCallable target, ValueOrRefType t, string name |
this.isDisambiguatingStaticCall0(c, target, name, t) |
hasStaticCallable(t, other, name) and
args = c.getNumberOfArguments() and
other != target
)