[vala/emit-let] codegen: Drop useless comma expression when handling struct arguments



commit 435b211c5312727668634034f52d89d282ad667e
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Mar 5 10:54:50 2011 +0100

    codegen: Drop useless comma expression when handling struct arguments

 codegen/valaccodebasemodule.vala |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 48f2730..2df1409 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4527,15 +4527,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 					return new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, cexpr);
 				} else {
 					// if cexpr is e.g. a function call, we can't take the address of the expression
-					// (tmp = expr, &tmp)
-					var ccomma = new CCodeCommaExpression ();
-
 					var temp_var = get_temp_variable (type, true, null, false);
 					emit_temp_var (temp_var);
-					ccomma.append_expression (new CCodeAssignment (get_variable_cexpression (temp_var.name), cexpr));
-					ccomma.append_expression (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression (temp_var.name)));
 
-					return ccomma;
+					ccode.add_assignment (get_variable_cexpression (temp_var.name), cexpr);
+					return new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression (temp_var.name));
 				}
 			}
 		}



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