[vala] codegen: Drop unnecessary comma expression in postfix expressions



commit 5ba395aa2eaeb9eaed109d32b75b046a5ed899d9
Author: Jürg Billeter <j bitron ch>
Date:   Sun Oct 10 09:12:25 2010 +0200

    codegen: Drop unnecessary comma expression in postfix expressions

 codegen/valaccodebasemodule.vala |   10 +++-------
 codegen/valadovabasemodule.vala  |   10 +++-------
 2 files changed, 6 insertions(+), 14 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 3514b7d..ddcdd79 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -3590,23 +3590,19 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 			// property postfix expression
 			var prop = (Property) ma.symbol_reference;
 			
-			var ccomma = new CCodeCommaExpression ();
-			
 			// assign current value to temp variable
 			var temp_decl = get_temp_variable (prop.property_type, true, expr, false);
 			emit_temp_var (temp_decl);
-			ccomma.append_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner)));
+			ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner)));
 			
 			// increment/decrement property
 			var op = expr.increment ? CCodeBinaryOperator.PLUS : CCodeBinaryOperator.MINUS;
 			var cexpr = new CCodeBinaryExpression (op, get_variable_cexpression (temp_decl.name), new CCodeConstant ("1"));
 			var ccall = get_property_set_call (prop, ma, cexpr);
-			ccomma.append_expression (ccall);
+			ccode.add_expression (ccall);
 			
 			// return previous value
-			ccomma.append_expression (get_variable_cexpression (temp_decl.name));
-			
-			set_cvalue (expr, ccomma);
+			set_cvalue (expr, get_variable_cexpression (temp_decl.name));
 			return;
 		}
 	
diff --git a/codegen/valadovabasemodule.vala b/codegen/valadovabasemodule.vala
index 72e147f..7eb81b6 100644
--- a/codegen/valadovabasemodule.vala
+++ b/codegen/valadovabasemodule.vala
@@ -1369,23 +1369,19 @@ public class Vala.DovaBaseModule : CodeGenerator {
 			// property postfix expression
 			var prop = (Property) ma.symbol_reference;
 
-			var ccomma = new CCodeCommaExpression ();
-
 			// assign current value to temp variable
 			var temp_decl = get_temp_variable (prop.property_type, true, expr);
 			emit_temp_var (temp_decl);
-			ccomma.append_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner)));
+			ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner)));
 
 			// increment/decrement property
 			var op = expr.increment ? CCodeBinaryOperator.PLUS : CCodeBinaryOperator.MINUS;
 			var cexpr = new CCodeBinaryExpression (op, get_variable_cexpression (temp_decl.name), new CCodeConstant ("1"));
 			var ccall = get_property_set_call (prop, ma, cexpr);
-			ccomma.append_expression (ccall);
+			ccode.add_expression (ccall);
 
 			// return previous value
-			ccomma.append_expression (new CCodeIdentifier (temp_decl.name));
-
-			set_cvalue (expr, ccomma);
+			set_cvalue (expr, new CCodeIdentifier (temp_decl.name));
 			return;
 		}
 



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