protected JvmTypeReference inferFunctionReturnType ( XtendFunction source , JvmOperation target , JvmOperation overriddenOperation ) { // The return type is explicitly given if ( source . getReturnType ( ) != null ) { return ensureValidType ( source . eResource ( ) , source . getReturnType ( ) ) ; } // An super operation was detected => reuse its return type. if ( overriddenOperation != null ) { final JvmTypeReference type = overriddenOperation . getReturnType ( ) ; //return cloneWithProxiesFromOtherResource(type, target); return this . typeReferences . createDelegateTypeReference ( type ) ; } // Return type is inferred from the operation's expression. final XExpression expression = source . getExpression ( ) ; JvmTypeReference returnType = null ; if ( expression != null && ( ( ! ( expression instanceof XBlockExpression ) ) || ( ! ( ( XBlockExpression ) expression ) . getExpressions ( ) . isEmpty ( ) ) ) ) { returnType = inferFunctionReturnType ( expression ) ; } return ensureValidType ( source . eResource ( ) , returnType ) ; }
Infer the return type for the given source function .