mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
C#: Only attempt to generate models for properties that does not both have a get and a set accessor.
This commit is contained in:
@@ -27,6 +27,10 @@ private predicate isHigherOrder(CS::Callable api) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private predicate irrelevantAccessor(CS::Accessor a) {
|
||||||
|
exists(CS::Property p | p = a.getDeclaration() | exists(p.getSetter()) and exists(p.getGetter()))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if it is relevant to generate models for `api`.
|
* Holds if it is relevant to generate models for `api`.
|
||||||
*/
|
*/
|
||||||
@@ -40,7 +44,10 @@ private predicate isRelevantForModels(CS::Callable api) {
|
|||||||
not api.(CS::Constructor).isParameterless() and
|
not api.(CS::Constructor).isParameterless() and
|
||||||
// Disregard all APIs that have a manual model.
|
// Disregard all APIs that have a manual model.
|
||||||
not api = any(FlowSummaryImpl::Public::SummarizedCallable sc | sc.applyManualModel()) and
|
not api = any(FlowSummaryImpl::Public::SummarizedCallable sc | sc.applyManualModel()) and
|
||||||
not api = any(FlowSummaryImpl::Public::NeutralSummaryCallable sc | sc.hasManualModel())
|
not api = any(FlowSummaryImpl::Public::NeutralSummaryCallable sc | sc.hasManualModel()) and
|
||||||
|
// Disregard properties that have both a get and a set accessor,
|
||||||
|
// which implicitly means auto implemented properties.
|
||||||
|
not irrelevantAccessor(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user