getAllReturnExpressions function

List<Expression?> getAllReturnExpressions(
  1. FunctionBody body
)

Returns all return expressions of a function body.

Implementation

List<Expression?> getAllReturnExpressions(FunctionBody body) {
  return switch (body) {
    BlockFunctionBody(:final block) => _ReturnExpressionGatherer.gather(block),
    ExpressionFunctionBody(:final expression) => [expression],
    EmptyFunctionBody() || NativeFunctionBody() => const [],
  };
}