C#: Only attempt to generate models for properties that does not both have a get and a set accessor.

This commit is contained in:
Michael Nebel
2024-04-04 13:21:34 +02:00
parent 32595b92a2
commit 8cc4f86e7d

View File

@@ -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)
} }
/** /**