C#: exclude parameterless constructors from DataFlowTargetApi

This commit is contained in:
Jami Cogswell
2022-12-08 11:12:57 -05:00
parent 16d8e8e931
commit a8a8b03d2f

View File

@@ -30,6 +30,11 @@ private predicate isHigherOrder(CS::Callable api) {
)
}
/** Holds if the given API is a constructor without parameters. */
private predicate isParameterlessConstructor(CS::Callable api) {
api instanceof CS::Constructor and api.getNumberOfParameters() = 0
}
/**
* Holds if it is relevant to generate models for `api`.
*/
@@ -38,7 +43,8 @@ private predicate isRelevantForModels(CS::Callable api) {
api.getDeclaringType().getNamespace().getFullName() != "" and
not api instanceof CS::ConversionOperator and
not api instanceof Util::MainMethod and
not api instanceof CS::Destructor
not api instanceof CS::Destructor and
not isParameterlessConstructor(api)
}
/**