C++: Add predicates for lambda parameter list

This commit is contained in:
idrissrio
2025-06-06 15:45:40 +02:00
parent 3ecc4c9ad7
commit 6c9959d8bc

View File

@@ -48,6 +48,19 @@ class LambdaExpression extends Expr, @lambdaexpr {
*/
predicate returnTypeIsExplicit() { lambdas(underlyingElement(this), _, true, _) }
/**
* Holds if the lambda has an explicitly specified parameter list, even when empty.
*/
predicate hasParameterList() { lambdas(underlyingElement(this), _, _, true) }
/**
* Holds if the lambda has an empty parameter list
*/
predicate emptyParameterListIsExplicit() {
this.hasParameterList() and
this.getLambdaFunction().getNumberOfParameters() = 0
}
/**
* Gets the function which will be invoked when the resulting object is called.
*