C++: Add LambdaExpression.getInitializer()

This commit is contained in:
Dave Bartolomeo
2019-03-25 10:52:57 -07:00
parent d20e5bc69c
commit 8770258714
2 changed files with 9 additions and 1 deletions

View File

@@ -57,6 +57,14 @@ class LambdaExpression extends Expr, @lambdaexpr {
Operator getLambdaFunction() {
result = getType().(Closure).getLambdaFunction()
}
/**
* Gets the initializer that initializes the captured variables in the closure, if any.
* A lambda that does not capture any variables will not have an initializer.
*/
Expr getInitializer() {
result = getChild(0)
}
}
/**

View File

@@ -270,7 +270,7 @@ newtype TTranslatedElement =
throw.getExpr().getFullyConverted() = expr
) or
exists(LambdaExpression lambda |
lambda.getChild(0).getFullyConverted() = expr
lambda.getInitializer().getFullyConverted() = expr
)
)
} or