bodyOrNull

inline fun <T : Statement> FunctionDeclaration.bodyOrNull(n: Int = 0): T?

This inline function returns the n-th body statement (in AST order) cast as T or null if it does not exist or the type does not match.

n can also be negative; in this case -1 corresponds to the last statement, -2 to the second to last and so on.

For convenience, n defaults to zero, so that the first statement is always easy to fetch.