public static Statement returnExpression ( final Expression expression ) { // TODO(lukes): it would be nice to do a checkType operation here to make sure that expression // is compatible with the return type of the method, but i don't know how to get that // information here (reasonably). So it is the caller's responsibility. return new Statement ( ) { @ Override protected void doGen ( CodeBuilder adapter ) { expression . gen ( adapter ) ; adapter . returnValue ( ) ; } } ; }
Generates a statement that returns the value produced by the given expression .