mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
C#: Refactor isIrrelevantOverrideOrImplementation to make it easier to extend it with more methods later.
This commit is contained in:
@@ -22,12 +22,18 @@ class Type = CS::Type;
|
||||
* is irrelevant to the data flow analysis.
|
||||
*/
|
||||
private predicate isIrrelevantOverrideOrImplementation(CS::Callable api) {
|
||||
exists(System::SystemObjectClass c |
|
||||
api = c.getGetHashCodeMethod().getAnOverrider*() or
|
||||
api = c.getEqualsMethod().getAnOverrider*()
|
||||
exists(CS::Callable exclude, CS::Method m |
|
||||
(
|
||||
api = m.getAnOverrider*().getUnboundDeclaration()
|
||||
or
|
||||
api = m.getAnUltimateImplementor().getUnboundDeclaration()
|
||||
) and
|
||||
exclude = m.getUnboundDeclaration()
|
||||
|
|
||||
exists(System::SystemObjectClass c | exclude = [c.getGetHashCodeMethod(), c.getEqualsMethod()])
|
||||
or
|
||||
exists(System::SystemIEquatableTInterface i | exclude = i.getEqualsMethod())
|
||||
)
|
||||
or
|
||||
exists(System::IEquatableEqualsMethod equals | equals = api)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user