private static Node returnedExpression ( Node fn ) { Node expectedBlock = NodeUtil . getFunctionBody ( fn ) ; if ( ! expectedBlock . hasOneChild ( ) ) { return null ; } Node expectedReturn = expectedBlock . getFirstChild ( ) ; if ( ! expectedReturn . isReturn ( ) ) { return null ; } if ( ! expectedReturn . hasOneChild ( ) ) { return null ; } return expectedReturn . getOnlyChild ( ) ; }
Return the node that represents the expression returned by the method given a FUNCTION node .