public ITreeAppendable compile ( XBlockExpression expr , ITreeAppendable b , LightweightTypeReference expectedReturnType ) { final boolean isPrimitiveVoidExpected = expectedReturnType . isPrimitiveVoid ( ) ; final boolean isPrimitiveVoid = isPrimitiveVoid ( expr ) ; final boolean earlyExit = isEarlyExit ( expr ) ; final boolean isImplicitReturn = ! isPrimitiveVoidExpected && ! isPrimitiveVoid && ! earlyExit ; final EList < XExpression > expressions = expr . getExpressions ( ) ; for ( int i = 0 ; i < expressions . size ( ) ; i ++ ) { XExpression ex = expressions . get ( i ) ; if ( i < expressions . size ( ) - 1 ) { internalToJavaStatement ( ex , b . trace ( ex , true ) , false ) ; } else { internalToJavaStatement ( ex , b . trace ( ex , true ) , isImplicitReturn ) ; if ( isImplicitReturn ) { b . newLine ( ) . append ( "return (" ) ; internalToConvertedExpression ( ex , b , expectedReturnType ) ; b . append ( ");" ) ; } } } return b ; }
this one trims the outer block