[vala] codegen: Do not emit the temp variable when methods return a struct



commit ba79200bad53b154305f5e744cc5a70805d69846
Author: Luca Bruno <lucabru src gnome org>
Date:   Fri Aug 26 22:30:12 2011 +0200

    codegen: Do not emit the temp variable when methods return a struct
    
    The temporary variable holding the result was uselessly emitted in the
    generated C code if the parent node was an expression statement.

 codegen/valaccodemethodcallmodule.vala |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 67104a7..7d92d72 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -730,7 +730,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 		}
 
 		if (expr.parent_node is ExpressionStatement && !expr.value_type.is_disposable ()) {
-			if (ccall_expr != null) {
+			if (ccall_expr != null && !return_result_via_out_param) {
 				ccode.add_expression (ccall_expr);
 			}
 		} else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]