]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Do not emit the temp variable when methods return a struct
authorLuca Bruno <lucabru@src.gnome.org>
Fri, 26 Aug 2011 20:30:12 +0000 (22:30 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Fri, 26 Aug 2011 20:46:38 +0000 (22:46 +0200)
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

index 67104a7d178ae9b92b5d00a1289c22c4f1f4c05f..7d92d72edb19c917f1fce633fa08c3d9523e23b4 100644 (file)
@@ -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 {