]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Add CCodeFunction.add_assignment convenience function
authorLuca Bruno <lucabru@src.gnome.org>
Mon, 17 Jan 2011 08:58:24 +0000 (09:58 +0100)
committerJürg Billeter <j@bitron.ch>
Wed, 19 Jan 2011 19:00:53 +0000 (20:00 +0100)
24 files changed:
ccode/valaccodefunction.vala
codegen/valaccodearraymodule.vala
codegen/valaccodeassignmentmodule.vala
codegen/valaccodebasemodule.vala
codegen/valaccodecontrolflowmodule.vala
codegen/valaccodememberaccessmodule.vala
codegen/valaccodemethodcallmodule.vala
codegen/valaccodemethodmodule.vala
codegen/valaccodestructmodule.vala
codegen/valadovaarraymodule.vala
codegen/valadovaassignmentmodule.vala
codegen/valadovabasemodule.vala
codegen/valadovaerrormodule.vala
codegen/valadovamethodcallmodule.vala
codegen/valadovaobjectmodule.vala
codegen/valagasyncmodule.vala
codegen/valagdbusclientmodule.vala
codegen/valagdbusmodule.vala
codegen/valagdbusservermodule.vala
codegen/valagerrormodule.vala
codegen/valagobjectmodule.vala
codegen/valagsignalmodule.vala
codegen/valagtypemodule.vala
codegen/valagvariantmodule.vala

index 20725eea571a22425a42bb2684f93478ce2336b4..f6c0477271000fed0a42ca0151b73785ecd9df3d 100644 (file)
@@ -245,6 +245,10 @@ public class Vala.CCodeFunction : CCodeNode {
                current_block.add_statement (new CCodeExpressionStatement (expression));
        }
 
+       public void add_assignment (CCodeExpression left, CCodeExpression right) {
+               add_expression (new CCodeAssignment (left, right));
+       }
+
        public void add_return (CCodeExpression? expression = null) {
                current_block.add_statement (new CCodeReturnStatement (expression));
        }
index 1a367f345f727ff425abe40df9369245ae768aa0..1d8d193c41e0170ed32b8fe2f5e0fecb6565cbe9 100644 (file)
@@ -32,7 +32,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                        if (rank > 1) {
                                append_initializer_list (name_cnode, (InitializerList) e, rank - 1, ref i);
                        } else {
-                               ccode.add_expression (new CCodeAssignment (new CCodeElementAccess (name_cnode, new CCodeConstant (i.to_string ())), get_cvalue (e)));
+                               ccode.add_assignment (new CCodeElementAccess (name_cnode, new CCodeConstant (i.to_string ())), get_cvalue (e));
                                i++;
                        }
                }
@@ -113,7 +113,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 
                emit_temp_var (temp_var);
 
-               ccode.add_expression (new CCodeAssignment (name_cnode, gnew));
+               ccode.add_assignment (name_cnode, gnew);
 
                if (expr.initializer_list != null) {
                        append_initializer_list (name_cnode, expr.initializer_list, expr.rank, ref i);
@@ -514,7 +514,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                        gnew.add_argument (length_expr);
 
                        ccode.add_declaration (array_type.get_cname (), cvardecl);
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("result"), gnew));
+                       ccode.add_assignment (new CCodeIdentifier ("result"), gnew);
 
                        ccode.add_declaration ("int", new CCodeVariableDeclarator ("i"));
 
@@ -522,7 +522,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                                           new CCodeBinaryExpression (CCodeBinaryOperator.LESS_THAN, new CCodeIdentifier ("i"), new CCodeIdentifier ("length")),
                                           new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, new CCodeIdentifier ("i")));
 
-                       ccode.add_expression (new CCodeAssignment (new CCodeElementAccess (new CCodeIdentifier ("result"), new CCodeIdentifier ("i")), get_ref_cexpression (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i")), null, array_type)));
+                       ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("result"), new CCodeIdentifier ("i")), get_ref_cexpression (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i")), null, array_type));
                        ccode.close ();
 
                        ccode.add_return (new CCodeIdentifier ("result"));
@@ -576,7 +576,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                                           new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, new CCodeIdentifier ("i")));
 
 
-                       ccode.add_expression (new CCodeAssignment (new CCodeElementAccess (new CCodeIdentifier ("dest"), new CCodeIdentifier ("i")), get_ref_cexpression (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i")), null, array_type)));
+                       ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("dest"), new CCodeIdentifier ("i")), get_ref_cexpression (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i")), null, array_type));
                } else {
                        cfile.add_include ("string.h");
 
@@ -647,15 +647,15 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
 
                var csizecheck = new CCodeBinaryExpression (CCodeBinaryOperator.EQUALITY, length, size);
                ccode.open_if (csizecheck);
-               ccode.add_expression (new CCodeAssignment (size, new CCodeConditionalExpression (size, new CCodeBinaryExpression (CCodeBinaryOperator.MUL, new CCodeConstant ("2"), size), new CCodeConstant ("4"))));
-               ccode.add_expression (new CCodeAssignment (array, renew_call));
+               ccode.add_assignment (size, new CCodeConditionalExpression (size, new CCodeBinaryExpression (CCodeBinaryOperator.MUL, new CCodeConstant ("2"), size), new CCodeConstant ("4")));
+               ccode.add_assignment (array, renew_call);
                ccode.close ();
 
-               ccode.add_expression (new CCodeAssignment (new CCodeElementAccess (array, new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, length)), value));
+               ccode.add_assignment (new CCodeElementAccess (array, new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, length)), value);
 
                if (array_type.element_type.is_reference_type_or_type_parameter ()) {
                        // NULL terminate array
-                       ccode.add_expression (new CCodeAssignment (new CCodeElementAccess (array, length), new CCodeConstant ("NULL")));
+                       ccode.add_assignment (new CCodeElementAccess (array, length), new CCodeConstant ("NULL"));
                }
 
                pop_function ();
index 7f20bc3076506acc53ad8687bf23006d10d30047..9c53c5ac40672ce4a2ffea976e0b8d9addbd8061 100644 (file)
@@ -55,13 +55,13 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
                                string lhs_temp_name = "_tmp%d_".printf (next_temp_var_id++);
                                var lhs_temp = new LocalVariable (lhs_value_type, "*" + lhs_temp_name);
                                emit_temp_var (lhs_temp);
-                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (lhs_temp_name), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, lhs)));
+                               ccode.add_assignment (get_variable_cexpression (lhs_temp_name), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, lhs));
                                lhs = new CCodeParenthesizedExpression (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (lhs_temp_name)));
                        }
 
                        var temp_decl = get_temp_variable (assignment.left.value_type, true, null, false);
                        emit_temp_var (temp_decl);
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), rhs));
+                       ccode.add_assignment (get_variable_cexpression (temp_decl.name), rhs);
                        if (unref_old) {
                                /* unref old value */
                                ccode.add_expression (get_unref_expression (lhs, assignment.left.value_type, assignment.left));
@@ -72,7 +72,7 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
                                for (int dim = 1; dim <= array_type.rank; dim++) {
                                        var lhs_array_len = get_array_length_cexpression (assignment.left, dim);
                                        var rhs_array_len = get_array_length_cexpression (assignment.right, dim);
-                                       ccode.add_expression (new CCodeAssignment (lhs_array_len, rhs_array_len));
+                                       ccode.add_assignment (lhs_array_len, rhs_array_len);
                                }
                                if (array_type.rank == 1) {
                                        var array_var = assignment.left.symbol_reference;
@@ -81,16 +81,16 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
                                            && ((array_var is LocalVariable && !array_local.captured) || array_var is Field)) {
                                                var lhs_array_size = get_array_size_cvalue (assignment.left.target_value);
                                                var rhs_array_len = get_array_length_cexpression (assignment.left, 1);
-                                               ccode.add_expression (new CCodeAssignment (lhs_array_size, rhs_array_len));
+                                               ccode.add_assignment (lhs_array_size, rhs_array_len);
                                        }
                                }
                        } else if (instance_delegate) {
                                CCodeExpression lhs_delegate_target_destroy_notify, rhs_delegate_target_destroy_notify;
                                var lhs_delegate_target = get_delegate_target_cexpression (assignment.left, out lhs_delegate_target_destroy_notify);
                                var rhs_delegate_target = get_delegate_target_cexpression (assignment.right, out rhs_delegate_target_destroy_notify);
-                               ccode.add_expression (new CCodeAssignment (lhs_delegate_target, rhs_delegate_target));
+                               ccode.add_assignment (lhs_delegate_target, rhs_delegate_target);
                                if (assignment.right.target_type.value_owned) {
-                                       ccode.add_expression (new CCodeAssignment (lhs_delegate_target_destroy_notify, rhs_delegate_target_destroy_notify));
+                                       ccode.add_assignment (lhs_delegate_target_destroy_notify, rhs_delegate_target_destroy_notify);
                                }
                        }
 
@@ -177,21 +177,21 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
                        ccode.add_expression (destroy_value (lvalue));
                }
 
-               ccode.add_expression (new CCodeAssignment (get_cvalue_ (lvalue), get_cvalue_ (value)));
+               ccode.add_assignment (get_cvalue_ (lvalue), get_cvalue_ (value));
 
                var array_type = variable.variable_type as ArrayType;
                if (array_type != null) {
                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                if (get_array_length_cvalue (lvalue, dim) != null) {
-                                       ccode.add_expression (new CCodeAssignment (get_array_length_cvalue (lvalue, dim), get_array_length_cvalue (value, dim)));
+                                       ccode.add_assignment (get_array_length_cvalue (lvalue, dim), get_array_length_cvalue (value, dim));
                                }
                        }
                        if (array_type.rank == 1) {
                                if (get_array_size_cvalue (lvalue) != null) {
                                        if (get_array_size_cvalue (value) != null) {
-                                               ccode.add_expression (new CCodeAssignment (get_array_size_cvalue (lvalue), get_array_size_cvalue (value)));
+                                               ccode.add_assignment (get_array_size_cvalue (lvalue), get_array_size_cvalue (value));
                                        } else {
-                                               ccode.add_expression (new CCodeAssignment (get_array_size_cvalue (lvalue), get_array_length_cvalue (value, 1)));
+                                               ccode.add_assignment (get_array_size_cvalue (lvalue), get_array_length_cvalue (value, 1));
                                        }
                                }
                        }
@@ -200,9 +200,9 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
                var delegate_type = variable.variable_type as DelegateType;
                if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
                        if (get_delegate_target_cvalue (lvalue) != null) {
-                               ccode.add_expression (new CCodeAssignment (get_delegate_target_cvalue (lvalue), get_delegate_target_cvalue (value)));
+                               ccode.add_assignment (get_delegate_target_cvalue (lvalue), get_delegate_target_cvalue (value));
                                if (get_delegate_target_destroy_notify_cvalue (lvalue) != null) {
-                                       ccode.add_expression (new CCodeAssignment (get_delegate_target_destroy_notify_cvalue (lvalue), get_delegate_target_destroy_notify_cvalue (value)));
+                                       ccode.add_assignment (get_delegate_target_destroy_notify_cvalue (lvalue), get_delegate_target_destroy_notify_cvalue (value));
                                }
                        }
                }
index fc7df904e7d6699aa0418dc9bdf0be1172494a16..f188209852dace15eff75cb7d45217535d5baacd 100644 (file)
@@ -959,7 +959,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                var rhs = get_cvalue (f.initializer);
 
-                               ccode.add_expression (new CCodeAssignment (lhs, rhs));
+                               ccode.add_assignment (lhs, rhs);
 
                                if (f.variable_type is ArrayType && !f.no_array_length &&
                                    f.initializer is ArrayCreationExpression) {
@@ -976,13 +976,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                                var array_len_lhs = get_array_length_cexpression (ma, dim);
                                                var size = sizes[dim - 1];
-                                               ccode.add_expression (new CCodeAssignment (array_len_lhs, get_cvalue (size)));
+                                               ccode.add_assignment (array_len_lhs, get_cvalue (size));
                                        }
 
                                        if (array_type.rank == 1 && f.is_internal_symbol ()) {
                                                var lhs_array_size = get_array_size_cvalue (ma.target_value);
                                                var rhs_array_len = get_array_length_cexpression (ma, 1);
-                                               ccode.add_expression (new CCodeAssignment (lhs_array_size, rhs_array_len));
+                                               ccode.add_assignment (lhs_array_size, rhs_array_len);
                                        }
                                }
 
@@ -1038,7 +1038,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                var rhs = get_cvalue (f.initializer);
 
-                               ccode.add_expression (new CCodeAssignment (lhs, rhs));
+                               ccode.add_assignment (lhs, rhs);
 
                                foreach (LocalVariable local in temp_ref_vars) {
                                        ccode.add_expression (get_unref_expression_ (local));
@@ -1154,11 +1154,11 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                        ccode.add_declaration (temp_decl.variable_type.get_cname (), vardecl);
 
                                                        var tmp = get_variable_cexpression (get_variable_cname (temp_decl.name));
-                                                       ccode.add_expression (new CCodeAssignment (lhs, tmp));
+                                                       ccode.add_assignment (lhs, tmp);
 
                                                        ccode.close ();
                                                } else {
-                                                       ccode.add_expression (new CCodeAssignment (lhs, rhs));
+                                                       ccode.add_assignment (lhs, rhs);
                                                }
 
                                                if (f.variable_type is ArrayType && !f.no_array_length &&
@@ -1173,7 +1173,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                                                var array_len_lhs = get_array_length_cexpression (ma, dim);
                                                                var size = sizes[dim - 1];
-                                                               ccode.add_expression (new CCodeAssignment (array_len_lhs, get_cvalue (size)));
+                                                               ccode.add_assignment (array_len_lhs, get_cvalue (size));
                                                        }
                                                }
                                        } else {
@@ -1605,7 +1605,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        if (is_virtual) {
                                ccode.add_declaration (this_type.get_cname (), new CCodeVariableDeclarator ("self"));
-                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), transform_expression (new CCodeIdentifier ("base"), base_type, this_type)));
+                               ccode.add_assignment (new CCodeIdentifier ("self"), transform_expression (new CCodeIdentifier ("base"), base_type, this_type));
                        }
 
                        acc.body.emit (this);
@@ -1672,13 +1672,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        param.captured = true;
                }
 
-               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_variable_cname (param.name)), cparam));
+               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_variable_cname (param.name)), cparam);
 
                if (param.variable_type is ArrayType) {
                        var array_type = (ArrayType) param.variable_type;
                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                data.add_field ("gint", get_parameter_array_length_cname (param, dim));
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_array_length_cname (get_variable_cname (param.name), dim)), new CCodeIdentifier (get_array_length_cname (get_variable_cname (param.name), dim))));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_array_length_cname (get_variable_cname (param.name), dim)), new CCodeIdentifier (get_array_length_cname (get_variable_cname (param.name), dim)));
                        }
                } else if (param.variable_type is DelegateType) {
                        CCodeExpression target_expr;
@@ -1692,10 +1692,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        }
 
                        data.add_field ("gpointer", get_delegate_target_cname (get_variable_cname (param.name)));
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_delegate_target_cname (get_variable_cname (param.name))), target_expr));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_delegate_target_cname (get_variable_cname (param.name))), target_expr);
                        if (param.variable_type.value_owned) {
                                data.add_field ("GDestroyNotify", get_delegate_target_destroy_notify_cname (get_variable_cname (param.name)));
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_delegate_target_destroy_notify_cname (get_variable_cname (param.name))), delegate_target_destroy_notify));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_delegate_target_destroy_notify_cname (get_variable_cname (param.name))), delegate_target_destroy_notify);
                        }
                }
 
@@ -1815,10 +1815,10 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        } else {
                                ccode.add_declaration (struct_name + "*", new CCodeVariableDeclarator ("_data%d_".printf (block_id)));
                        }
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression ("_data%d_".printf (block_id)), data_alloc));
+                       ccode.add_assignment (get_variable_cexpression ("_data%d_".printf (block_id)), data_alloc);
 
                        // initialize ref_count
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "_ref_count_"), new CCodeIdentifier ("1")));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "_ref_count_"), new CCodeIdentifier ("1"));
 
                        if (parent_block != null) {
                                int parent_block_id = get_block_id (parent_block);
@@ -1826,7 +1826,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                var ref_call = new CCodeFunctionCall (new CCodeIdentifier ("block%d_data_ref".printf (parent_block_id)));
                                ref_call.add_argument (get_variable_cexpression ("_data%d_".printf (parent_block_id)));
 
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "_data%d_".printf (parent_block_id)), ref_call));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "_data%d_".printf (parent_block_id)), ref_call);
                        } else {
                                if (in_constructor || (current_method != null && current_method.binding == MemberBinding.INSTANCE &&
                                                              (!(current_method is CreationMethod) || current_method.body != b)) ||
@@ -1834,7 +1834,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        var ref_call = new CCodeFunctionCall (get_dup_func_expression (new ObjectType (current_class), b.source_reference));
                                        ref_call.add_argument (get_result_cexpression ("self"));
 
-                                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "self"), ref_call));
+                                       ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "self"), ref_call);
                                }
 
                                if (current_method != null) {
@@ -1843,13 +1843,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                string func_name;
 
                                                func_name = "%s_type".printf (type_param.name.down ());
-                                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name)));
+                                               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name));
 
                                                func_name = "%s_dup_func".printf (type_param.name.down ());
-                                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name)));
+                                               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name));
 
                                                func_name = "%s_destroy_func".printf (type_param.name.down ());
-                                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name)));
+                                               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name), new CCodeIdentifier (func_name));
                                        }
                                }
                        }
@@ -1870,7 +1870,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                        // async method is suspended while waiting for callback,
                                        // so we never need to care about memory management of async data
-                                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "_async_data_"), new CCodeIdentifier ("data")));
+                                       ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), "_async_data_"), new CCodeIdentifier ("data"));
                                }
                        } else if (b.parent_symbol is PropertyAccessor) {
                                var acc = (PropertyAccessor) b.parent_symbol;
@@ -2059,17 +2059,17 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                } else {
                                        var temp_var = get_temp_variable (local.variable_type, true, local, false);
                                        emit_temp_var (temp_var);
-                                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_var.name), rhs));
+                                       ccode.add_assignment (get_variable_cexpression (temp_var.name), rhs);
 
                                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                                var lhs_array_len = get_array_length_cvalue (target_value, dim);
                                                var rhs_array_len = get_array_length_cexpression (local.initializer, dim);
-                                               ccode.add_expression (new CCodeAssignment (lhs_array_len, rhs_array_len));
+                                               ccode.add_assignment (lhs_array_len, rhs_array_len);
                                        }
                                        if (array_type.rank == 1 && !local.captured) {
                                                var lhs_array_size = get_array_size_cvalue (target_value);
                                                var rhs_array_len = get_array_length_cvalue (target_value, 1);
-                                               ccode.add_expression (new CCodeAssignment (lhs_array_size, rhs_array_len));
+                                               ccode.add_assignment (lhs_array_size, rhs_array_len);
                                        }
 
                                        rhs = get_variable_cexpression (temp_var.name);
@@ -2080,17 +2080,17 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                if (d.has_target) {
                                        var temp_var = get_temp_variable (local.variable_type, true, local, false);
                                        emit_temp_var (temp_var);
-                                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_var.name), rhs));
+                                       ccode.add_assignment (get_variable_cexpression (temp_var.name), rhs);
 
                                        var lhs_delegate_target = get_delegate_target_cvalue (target_value);
                                        var lhs_delegate_target_destroy_notify = get_delegate_target_destroy_notify_cvalue (target_value);
 
                                        CCodeExpression rhs_delegate_target_destroy_notify;
                                        var rhs_delegate_target = get_delegate_target_cexpression (local.initializer, out rhs_delegate_target_destroy_notify);
-                                       ccode.add_expression (new CCodeAssignment (lhs_delegate_target, rhs_delegate_target));
+                                       ccode.add_assignment (lhs_delegate_target, rhs_delegate_target);
 
                                        if (deleg_type.value_owned) {
-                                               ccode.add_expression (new CCodeAssignment (lhs_delegate_target_destroy_notify, rhs_delegate_target_destroy_notify));
+                                               ccode.add_assignment (lhs_delegate_target_destroy_notify, rhs_delegate_target_destroy_notify);
                                        }
 
                                        rhs = get_variable_cexpression (temp_var.name);
@@ -2107,7 +2107,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        rhs = null;
                                } else {
                                        for (int dim = 1; dim <= array_type.rank; dim++) {
-                                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (get_array_length_cname (get_variable_cname (local.name), dim)), new CCodeConstant ("0")));
+                                               ccode.add_assignment (get_variable_cexpression (get_array_length_cname (get_variable_cname (local.name), dim)), new CCodeConstant ("0"));
                                        }
                                }
                        }
@@ -2118,7 +2118,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                if (has_simple_struct_initializer (local)) {
                                        ccode.add_expression (rhs);
                                } else {
-                                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id ((Block) local.parent_symbol))), get_variable_cname (local.name)), rhs));
+                                       ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id ((Block) local.parent_symbol))), get_variable_cname (local.name)), rhs);
                                }
                        }
                } else if (current_method != null && current_method.coroutine) {
@@ -2128,7 +2128,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                if (has_simple_struct_initializer (local)) {
                                        ccode.add_expression (rhs);
                                } else {
-                                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_variable_cname (local.name)), rhs));
+                                       ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_variable_cname (local.name)), rhs);
                                }
                        }
                } else {
@@ -2154,7 +2154,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        if (cvar.initializer != null && !cvar.init0) {
                                cvar.initializer = null;
-                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (local.name), rhs));
+                               ccode.add_assignment (get_variable_cexpression (local.name), rhs);
                        }
 
                        if (post_rhs != null) {
@@ -2588,7 +2588,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        var creation_call = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
                        creation_call.add_argument (new CCodeConstant (value_type.data_type.get_cname ()));
                        creation_call.add_argument (new CCodeConstant ("1"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("dup"), creation_call));
+                       ccode.add_assignment (new CCodeIdentifier ("dup"), creation_call);
 
                        var st = value_type.data_type as Struct;
                        if (st != null && st.is_disposable ()) {
@@ -3144,7 +3144,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                memset_call.add_argument (new CCodeIdentifier ("sizeof (%s)".printf (local.variable_type.get_cname ())));
                                ccode.add_expression (memset_call);
                        } else if (vardecl.initializer != null) {
-                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (local.name), vardecl.initializer));
+                               ccode.add_assignment (get_variable_cexpression (local.name), vardecl.initializer);
                        }
                } else {
                        ccode.add_declaration (local.variable_type.get_cname (), vardecl);
@@ -3242,12 +3242,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                var delegate_type = param.variable_type as DelegateType;
 
                ccode.open_if (get_variable_cexpression (param.name));
-               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (param.name)), get_variable_cexpression ("_" + param.name)));
+               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (param.name)), get_variable_cexpression ("_" + param.name));
 
                if (delegate_type != null && delegate_type.delegate_symbol.has_target) {
-                       ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (get_delegate_target_cname (param.name))), new CCodeIdentifier (get_delegate_target_cname (get_variable_cname ("_" + param.name)))));
+                       ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (get_delegate_target_cname (param.name))), new CCodeIdentifier (get_delegate_target_cname (get_variable_cname ("_" + param.name))));
                        if (delegate_type.value_owned) {
-                               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (get_delegate_target_destroy_notify_cname (param.name))), new CCodeIdentifier (get_delegate_target_destroy_notify_cname (get_variable_cname ("_" + param.name)))));
+                               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (get_delegate_target_destroy_notify_cname (param.name))), new CCodeIdentifier (get_delegate_target_destroy_notify_cname (get_variable_cname ("_" + param.name))));
                        }
                }
 
@@ -3261,7 +3261,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (array_type != null && !array_type.fixed_length && !param.no_array_length) {
                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                ccode.open_if (get_variable_cexpression (get_parameter_array_length_cname (param, dim)));
-                               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (get_parameter_array_length_cname (param, dim))), new CCodeIdentifier (get_array_length_cname (get_variable_cname ("_" + param.name), dim))));
+                               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (get_parameter_array_length_cname (param, dim))), new CCodeIdentifier (get_array_length_cname (get_variable_cname ("_" + param.name), dim)));
                                ccode.close ();
                        }
                }
@@ -3288,7 +3288,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (((current_method != null && !current_method.no_array_length) || current_property_accessor != null) && current_return_type is ArrayType) {
                        var return_expr_decl = get_temp_variable (stmt.return_expression.value_type, true, stmt, false);
 
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (return_expr_decl.name), get_cvalue (stmt.return_expression)));
+                       ccode.add_assignment (get_variable_cexpression (return_expr_decl.name), get_cvalue (stmt.return_expression));
 
                        var array_type = (ArrayType) current_return_type;
 
@@ -3298,7 +3298,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        len_l = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, len_l);
                                }
                                var len_r = get_array_length_cexpression (stmt.return_expression, dim);
-                               ccode.add_expression (new CCodeAssignment (len_l, len_r));
+                               ccode.add_assignment (len_l, len_r);
                        }
 
                        set_cvalue (stmt.return_expression, get_variable_cexpression (return_expr_decl.name));
@@ -3309,7 +3309,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        if (delegate_type.delegate_symbol.has_target) {
                                var return_expr_decl = get_temp_variable (stmt.return_expression.value_type, true, stmt, false);
 
-                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (return_expr_decl.name), get_cvalue (stmt.return_expression)));
+                               ccode.add_assignment (get_variable_cexpression (return_expr_decl.name), get_cvalue (stmt.return_expression));
 
                                var target_l = get_result_cexpression (get_delegate_target_cname ("result"));
                                if (current_method == null || !current_method.coroutine) {
@@ -3317,13 +3317,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                }
                                CCodeExpression target_r_destroy_notify;
                                var target_r = get_delegate_target_cexpression (stmt.return_expression, out target_r_destroy_notify);
-                               ccode.add_expression (new CCodeAssignment (target_l, target_r));
+                               ccode.add_assignment (target_l, target_r);
                                if (delegate_type.value_owned) {
                                        var target_l_destroy_notify = get_result_cexpression (get_delegate_target_destroy_notify_cname ("result"));
                                        if (current_method == null || !current_method.coroutine) {
                                                target_l_destroy_notify = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, target_l_destroy_notify);
                                        }
-                                       ccode.add_expression (new CCodeAssignment (target_l_destroy_notify, target_r_destroy_notify));
+                                       ccode.add_assignment (target_l_destroy_notify, target_r_destroy_notify);
                                }
 
                                set_cvalue (stmt.return_expression, get_variable_cexpression (return_expr_decl.name));
@@ -3338,7 +3338,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        if (current_return_type.is_real_non_null_struct_type () && (current_method == null || !current_method.coroutine)) {
                                result_lhs = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, result_lhs);
                        }
-                       ccode.add_expression (new CCodeAssignment (result_lhs, get_cvalue (stmt.return_expression)));
+                       ccode.add_assignment (result_lhs, get_cvalue (stmt.return_expression));
                }
 
                // free local variables
@@ -3567,7 +3567,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        regex_new_call.add_argument (new CCodeConstant ("match_options"));
                        regex_new_call.add_argument (new CCodeConstant ("0"));
                        regex_new_call.add_argument (new CCodeConstant ("NULL"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("GRegex* val"), regex_new_call));
+                       ccode.add_assignment (new CCodeIdentifier ("GRegex* val"), regex_new_call);
 
                        var once_leave_call = new CCodeFunctionCall (new CCodeIdentifier ("g_once_init_leave"));
                        once_leave_call.add_argument (new CCodeConstant ("(volatile gsize*) re"));
@@ -3656,7 +3656,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        // assign current value to temp variable
                        var temp_decl = get_temp_variable (prop.property_type, true, expr, false);
                        emit_temp_var (temp_decl);
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner)));
+                       ccode.add_assignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner));
                        
                        // increment/decrement property
                        var op = expr.increment ? CCodeBinaryOperator.PLUS : CCodeBinaryOperator.MINUS;
@@ -3676,12 +3676,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        // assign current value to temp variable
                        var temp_decl = get_temp_variable (expr.inner.value_type, true, expr, false);
                        emit_temp_var (temp_decl);
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner)));
+                       ccode.add_assignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner));
 
                        // increment/decrement variable
                        var op = expr.increment ? CCodeBinaryOperator.PLUS : CCodeBinaryOperator.MINUS;
                        var cexpr = new CCodeBinaryExpression (op, get_variable_cexpression (temp_decl.name), new CCodeConstant ("1"));
-                       ccode.add_expression (new CCodeAssignment (get_cvalue (expr.inner), cexpr));
+                       ccode.add_assignment (get_cvalue (expr.inner), cexpr);
 
                        // return previous value
                        set_cvalue (expr, get_variable_cexpression (temp_decl.name));
@@ -4335,7 +4335,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        if (expr.type_reference.data_type is Struct) {
                                ccode.add_expression (creation_expr);
                        } else {
-                               ccode.add_expression (new CCodeAssignment (instance, creation_expr));
+                               ccode.add_assignment (instance, creation_expr);
                        }
 
                        foreach (MemberInitializer init in expr.get_object_initializer ()) {
@@ -4349,7 +4349,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        } else {
                                                lhs = new CCodeMemberAccess.pointer (typed_inst, f.get_cname ());
                                        }
-                                       ccode.add_expression (new CCodeAssignment (lhs, get_cvalue (init.initializer)));
+                                       ccode.add_assignment (lhs, get_cvalue (init.initializer));
 
                                        if (f.variable_type is ArrayType && !f.no_array_length) {
                                                var array_type = (ArrayType) f.variable_type;
@@ -4360,7 +4360,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                                lhs = new CCodeMemberAccess.pointer (typed_inst, get_array_length_cname (f.get_cname (), dim));
                                                        }
                                                        var rhs_array_len = get_array_length_cexpression (init.initializer, dim);
-                                                       ccode.add_expression (new CCodeAssignment (lhs, rhs_array_len));
+                                                       ccode.add_assignment (lhs, rhs_array_len);
                                                }
                                        } else if (f.variable_type is DelegateType && (f.variable_type as DelegateType).delegate_symbol.has_target && !f.no_delegate_target) {
                                                if (expr.type_reference.data_type is Struct) {
@@ -4370,7 +4370,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                }
                                                CCodeExpression rhs_delegate_target_destroy_notify;
                                                var rhs_delegate_target = get_delegate_target_cexpression (init.initializer, out rhs_delegate_target_destroy_notify);
-                                               ccode.add_expression (new CCodeAssignment (lhs, rhs_delegate_target));
+                                               ccode.add_assignment (lhs, rhs_delegate_target);
                                        }
 
                                        var cl = f.parent_symbol as Class;
@@ -4394,7 +4394,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        emit_temp_var (temp_var);
 
-                       ccode.add_expression (new CCodeAssignment (temp_ref, creation_expr));
+                       ccode.add_assignment (temp_ref, creation_expr);
                        set_cvalue (expr, temp_ref);
                }
        }
@@ -4699,9 +4699,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                emit_temp_var (temp_decl);
                var cvar = get_variable_cexpression (temp_decl.name);
 
-               ccode.add_expression (new CCodeAssignment (cvar, get_cvalue (expr.inner)));
+               ccode.add_assignment (cvar, get_cvalue (expr.inner));
                if (!(expr.value_type is DelegateType)) {
-                       ccode.add_expression (new CCodeAssignment (get_cvalue (expr.inner), new CCodeConstant ("NULL")));
+                       ccode.add_assignment (get_cvalue (expr.inner), new CCodeConstant ("NULL"));
                }
 
                set_cvalue (expr, cvar);
@@ -4720,14 +4720,14 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        var target_cvar = get_variable_cexpression (temp_target_decl.name);
                        CCodeExpression target_destroy_notify;
                        var target = get_delegate_target_cexpression (expr.inner, out target_destroy_notify);
-                       ccode.add_expression (new CCodeAssignment (target_cvar, target));
+                       ccode.add_assignment (target_cvar, target);
                        set_delegate_target (expr, target_cvar);
                        if (target_destroy_notify != null) {
                                var temp_target_destroy_notify_decl = get_temp_variable (gdestroynotify_type, true, expr, false);
                                emit_temp_var (temp_target_destroy_notify_decl);
                                var target_destroy_notify_cvar = get_variable_cexpression (temp_target_destroy_notify_decl.name);
-                               ccode.add_expression (new CCodeAssignment (target_destroy_notify_cvar, target_destroy_notify));
-                               ccode.add_expression (new CCodeAssignment (target_destroy_notify, new CCodeConstant ("NULL")));
+                               ccode.add_assignment (target_destroy_notify_cvar, target_destroy_notify);
+                               ccode.add_assignment (target_destroy_notify, new CCodeConstant ("NULL"));
                                set_delegate_target_destroy_notify (expr, target_destroy_notify_cvar);
                        }
                }
@@ -5166,7 +5166,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                var decl = get_temp_variable (expression_type, true, expression_type, false);
                                emit_temp_var (decl);
                                temp_ref_vars.insert (0, decl);
-                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (decl.name), cexpr));
+                               ccode.add_assignment (get_variable_cexpression (decl.name), cexpr);
                                cexpr = get_variable_cexpression (decl.name);
 
                                if (expression_type is ArrayType && expr != null) {
@@ -5174,7 +5174,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                                var len_decl = new LocalVariable (int_type.copy (), get_array_length_cname (decl.name, dim));
                                                emit_temp_var (len_decl);
-                                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (len_decl.name), get_array_length_cexpression (expr, dim)));
+                                               ccode.add_assignment (get_variable_cexpression (len_decl.name), get_array_length_cexpression (expr, dim));
                                        }
                                } else if (expression_type is DelegateType && expr != null) {
                                        var target_decl = new LocalVariable (new PointerType (new VoidType ()), get_delegate_target_cname (decl.name));
@@ -5182,8 +5182,8 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        var target_destroy_notify_decl = new LocalVariable (gdestroynotify_type, get_delegate_target_destroy_notify_cname (decl.name));
                                        emit_temp_var (target_destroy_notify_decl);
                                        CCodeExpression target_destroy_notify;
-                                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (target_decl.name), get_delegate_target_cexpression (expr, out target_destroy_notify)));
-                                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (target_destroy_notify_decl.name), target_destroy_notify));
+                                       ccode.add_assignment (get_variable_cexpression (target_decl.name), get_delegate_target_cexpression (expr, out target_destroy_notify));
+                                       ccode.add_assignment (get_variable_cexpression (target_destroy_notify_decl.name), target_destroy_notify);
 
                                }
                        }
@@ -5314,7 +5314,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                var decl = get_temp_variable (target_type, true, node, false);
                                emit_temp_var (decl);
-                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (decl.name), get_ref_cexpression (target_type, cexpr, expr, node)));
+                               ccode.add_assignment (get_variable_cexpression (decl.name), get_ref_cexpression (target_type, cexpr, expr, node));
                                cexpr = get_variable_cexpression (decl.name);
                        }
                }
@@ -5426,7 +5426,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                                        var temp_var = get_temp_variable (instance.target_type, true, null, false);
                                        emit_temp_var (temp_var);
-                                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_var.name), cinstance));
+                                       ccode.add_assignment (get_variable_cexpression (temp_var.name), cinstance);
 
                                        cinstance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression (temp_var.name));
                                }
@@ -5451,7 +5451,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (array_type != null && !prop.no_array_length) {
                        var temp_var = get_temp_variable (prop.property_type, true, null, false);
                        emit_temp_var (temp_var);
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_var.name), cexpr));
+                       ccode.add_assignment (get_variable_cexpression (temp_var.name), cexpr);
                        ccall.add_argument (get_variable_cexpression (temp_var.name));
                } else {
                        ccall.add_argument (cexpr);
@@ -5773,13 +5773,13 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                        array_copy_call.add_argument (size);
                                        ccode.add_expression (array_copy_call);
                                } else {
-                                       ccode.add_expression (new CCodeAssignment (dest, copy));
+                                       ccode.add_assignment (dest, copy);
 
                                        if (array_type != null && !f.no_array_length) {
                                                for (int dim = 1; dim <= array_type.rank; dim++) {
                                                        var len_src = new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), get_array_length_cname (f.name, dim));
                                                        var len_dest = new CCodeMemberAccess.pointer (new CCodeIdentifier ("dest"), get_array_length_cname (f.name, dim));
-                                                       ccode.add_expression (new CCodeAssignment (len_dest, len_src));
+                                                       ccode.add_assignment (len_dest, len_src);
                                                }
                                        }
                                }
index eb8e1ef78fa6c2779b61ac278492954f571de2d0..b51fe5fe45be9d55f501917346e8e7a681ea404a 100644 (file)
@@ -236,7 +236,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        var ccolvardecl = new CCodeVariableDeclarator (collection_backup.name);
                        ccode.add_declaration (collection_type.get_cname (), ccolvardecl);
                }
-               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (collection_backup.name), get_cvalue (stmt.collection)));
+               ccode.add_assignment (get_variable_cexpression (collection_backup.name), get_cvalue (stmt.collection));
                
                if (stmt.tree_can_fail && stmt.collection.tree_can_fail) {
                        // exception handling
@@ -254,7 +254,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        } else {
                                ccode.add_declaration ("int", new CCodeVariableDeclarator (get_array_length_cname (collection_backup.name, 1)));
                        }
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (get_array_length_cname (collection_backup.name, 1)), array_len));
+                       ccode.add_assignment (get_variable_cexpression (get_array_length_cname (collection_backup.name, 1)), array_len);
 
                        var it_name = (stmt.variable_name + "_it");
                
@@ -281,7 +281,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        } else {
                                ccode.add_declaration (stmt.type_reference.get_cname (), new CCodeVariableDeclarator (stmt.variable_name));
                        }
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (stmt.variable_name), element_expr));
+                       ccode.add_assignment (get_variable_cexpression (stmt.variable_name), element_expr);
 
                        // add array length variable for stacked arrays
                        if (stmt.type_reference is ArrayType) {
@@ -289,7 +289,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                                for (int dim = 1; dim <= inner_array_type.rank; dim++) {
                                        if (current_method != null && current_method.coroutine) {
                                                closure_struct.add_field ("int", get_array_length_cname (stmt.variable_name, dim));
-                                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (get_array_length_cname (stmt.variable_name, dim)), new CCodeConstant ("-1")));
+                                               ccode.add_assignment (get_variable_cexpression (get_array_length_cname (stmt.variable_name, dim)), new CCodeConstant ("-1"));
                                        } else {
                                                ccode.add_declaration ("int", new CCodeVariableDeclarator (get_array_length_cname (stmt.variable_name, dim), new CCodeConstant ("-1")));
                                        }
@@ -334,7 +334,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        } else {
                                ccode.add_declaration (stmt.type_reference.get_cname (), new CCodeVariableDeclarator (stmt.variable_name));
                        }
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (stmt.variable_name), element_expr));
+                       ccode.add_assignment (get_variable_cexpression (stmt.variable_name), element_expr);
 
                        stmt.body.emit (this);
 
@@ -371,7 +371,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        } else {
                                ccode.add_declaration (stmt.type_reference.get_cname (), new CCodeVariableDeclarator (stmt.variable_name));
                        }
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (stmt.variable_name), element_expr));
+                       ccode.add_assignment (get_variable_cexpression (stmt.variable_name), element_expr);
 
                        stmt.body.emit (this);
 
index 1f7a1ff36aa664775a2335ec7318456091c58e58..bad542dcabcfb50809e6ef19e66f1502e1e81a28 100644 (file)
@@ -436,7 +436,7 @@ public abstract class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
                                        ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, ctemp));
                                        ccode.add_expression (ccall);
                                } else {
-                                       ccode.add_expression (new CCodeAssignment (ctemp, ccall));
+                                       ccode.add_assignment (ctemp, ccall);
 
                                        array_type = base_property.property_type as ArrayType;
                                        if (array_type != null && !base_property.no_array_length) {
index cb408aa6d561c18ec6347e1e51640fc2d97b4f1b..e54d79ccbd2ec55f6dd762917a6a867c516f931b 100644 (file)
@@ -689,7 +689,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        // set state before calling async function to support immediate callbacks
                        int state = next_coroutine_state++;
 
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ())));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ()));
                        ccode.add_expression (async_call);
                        ccode.add_return (new CCodeConstant ("FALSE"));
                        ccode.add_label ("_state_%d".printf (state));
@@ -721,16 +721,16 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        czero.add_argument (new CCodeConstant ("0"));
                        czero.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.MUL, csizeof, cdelta));
 
-                       ccode.add_expression (new CCodeAssignment (temp_ref, new_size));
+                       ccode.add_assignment (temp_ref, new_size);
                        ccode.add_expression (ccall_expr);
                        ccode.add_expression (new CCodeConditionalExpression (ccheck, czero, new CCodeConstant ("NULL")));
-                       ccode.add_expression (new CCodeAssignment (get_array_length_cexpression (ma.inner, 1), temp_ref));
+                       ccode.add_assignment (get_array_length_cexpression (ma.inner, 1), temp_ref);
 
                        var array_var = ma.inner.symbol_reference;
                        var array_local = array_var as LocalVariable;
                        if (array_var != null && array_var.is_internal_symbol ()
                            && ((array_var is LocalVariable && !array_local.captured) || array_var is Field)) {
-                               ccode.add_expression (new CCodeAssignment (get_array_size_cvalue (ma.inner.target_value), temp_ref));
+                               ccode.add_assignment (get_array_size_cvalue (ma.inner.target_value), temp_ref);
                        }
 
                        return;
@@ -757,7 +757,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
 
                        emit_temp_var (temp_var);
 
-                       ccode.add_expression (new CCodeAssignment (temp_ref, ccall_expr));
+                       ccode.add_assignment (temp_ref, ccall_expr);
                        set_cvalue (expr, temp_ref);
                }
 
@@ -782,18 +782,18 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
                        }
 
                        // assign new value
-                       ccode.add_expression (new CCodeAssignment (get_cvalue (unary.inner), transform_expression (get_cvalue (unary), unary.target_type, unary.inner.value_type, arg)));
+                       ccode.add_assignment (get_cvalue (unary.inner), transform_expression (get_cvalue (unary), unary.target_type, unary.inner.value_type, arg));
 
                        var array_type = arg.value_type as ArrayType;
                        if (array_type != null) {
                                for (int dim = 1; dim <= array_type.rank; dim++) {
-                                       ccode.add_expression (new CCodeAssignment (get_array_sizes (unary.inner).get (dim - 1), get_array_sizes (unary).get (dim - 1)));
+                                       ccode.add_assignment (get_array_sizes (unary.inner).get (dim - 1), get_array_sizes (unary).get (dim - 1));
                                }
                        }
 
                        var delegate_type = arg.value_type as DelegateType;
                        if (delegate_type != null) {
-                               ccode.add_expression (new CCodeAssignment (get_delegate_target (unary.inner), get_delegate_target (unary)));
+                               ccode.add_assignment (get_delegate_target (unary.inner), get_delegate_target (unary));
                        }
                }
        }
index 428dac1e6a30d4b74e3bc5a129a9443a6c15dba0..0b8c81af8a0969c4b1e4a3cff57f93336c6ca37b 100644 (file)
@@ -391,7 +391,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
 
                                                var parent_data = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), "_data%d_".printf (parent_block_id));
                                                ccode.add_declaration ("Block%dData*".printf (parent_block_id), new CCodeVariableDeclarator ("_data%d_".printf (parent_block_id)));
-                                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_data%d_".printf (parent_block_id)), parent_data));
+                                               ccode.add_assignment (new CCodeIdentifier ("_data%d_".printf (parent_block_id)), parent_data);
 
                                                closure_block = parent_closure_block;
                                                block_id = parent_block_id;
@@ -402,7 +402,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                        if (m.binding == MemberBinding.INSTANCE) {
                                                var cself = new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), "self");
                                                ccode.add_declaration ("%s *".printf (current_class.get_cname ()), new CCodeVariableDeclarator ("self"));
-                                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), cself));
+                                               ccode.add_assignment (new CCodeIdentifier ("self"), cself);
                                        }
 
                                        // allow capturing generic type parameters
@@ -411,15 +411,15 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
 
                                                func_name = "%s_type".printf (type_param.name.down ());
                                                ccode.add_declaration ("GType", new CCodeVariableDeclarator (func_name));
-                                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier (func_name), new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name)));
+                                               ccode.add_assignment (new CCodeIdentifier (func_name), new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name));
 
                                                func_name = "%s_dup_func".printf (type_param.name.down ());
                                                ccode.add_declaration ("GBoxedCopyFunc", new CCodeVariableDeclarator (func_name));
-                                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier (func_name), new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name)));
+                                               ccode.add_assignment (new CCodeIdentifier (func_name), new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name));
 
                                                func_name = "%s_destroy_func".printf (type_param.name.down ());
                                                ccode.add_declaration ("GDestroyNotify", new CCodeVariableDeclarator (func_name));
-                                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier (func_name), new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name)));
+                                               ccode.add_assignment (new CCodeIdentifier (func_name), new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), func_name));
                                        }
                                } else if (m.parent_symbol is Class && !m.coroutine) {
                                        var cl = (Class) m.parent_symbol;
@@ -437,7 +437,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                                CCodeExpression cself = transform_expression (new CCodeIdentifier ("base"), base_expression_type, self_target_type);
 
                                                ccode.add_declaration ("%s *".printf (cl.get_cname ()), new CCodeVariableDeclarator ("self"));
-                                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), cself));
+                                               ccode.add_assignment (new CCodeIdentifier ("self"), cself);
                                        } else if (m.binding == MemberBinding.INSTANCE
                                                   && !(m is CreationMethod)) {
                                                create_method_type_check_statement (m, creturn_type, cl, true, "self");
@@ -502,7 +502,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                                if (cl.is_fundamental ()) {
                                                        var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_create_instance"));
                                                        ccall.add_argument (new CCodeIdentifier ("object_type"));
-                                                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), new CCodeCastExpression (ccall, cl.get_cname () + "*")));
+                                                       ccode.add_assignment (new CCodeIdentifier ("self"), new CCodeCastExpression (ccall, cl.get_cname () + "*"));
 
                                                        /* type, dup func, and destroy func fields for generic types */
                                                        foreach (TypeParameter type_param in current_class.get_type_parameters ()) {
@@ -532,7 +532,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                                        // TODO implicitly chain up to base class as in add_object_creation
                                                        var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_slice_new0"));
                                                        ccall.add_argument (new CCodeIdentifier (cl.get_cname ()));
-                                                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), ccall));
+                                                       ccode.add_assignment (new CCodeIdentifier ("self"), ccall);
                                                }
 
                                                if (cl.base_class == null) {
@@ -945,7 +945,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                } else {
                        /* store method return value for postconditions */
                        ccode.add_declaration (get_creturn_type (m, return_type.get_cname ()), new CCodeVariableDeclarator ("result"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("result"), vcall));
+                       ccode.add_assignment (new CCodeIdentifier ("result"), vcall);
                }
 
                if (m.get_postconditions ().size > 0) {
index 0eb0dde1dd701bda9720cb7cb6adc90b17403514..553e8218da3137d052bfb818439091eea7707337 100644 (file)
@@ -291,13 +291,13 @@ public abstract class Vala.CCodeStructModule : CCodeBaseModule {
                                        array_copy_call.add_argument (size);
                                        ccode.add_expression (array_copy_call);
                                } else {
-                                       ccode.add_expression (new CCodeAssignment (dest, copy));
+                                       ccode.add_assignment (dest, copy);
 
                                        if (array_type != null) {
                                                for (int dim = 1; dim <= array_type.rank; dim++) {
                                                        var len_src = new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), get_array_length_cname (f.name, dim));
                                                        var len_dest = new CCodeMemberAccess.pointer (new CCodeIdentifier ("dest"), get_array_length_cname (f.name, dim));
-                                                       ccode.add_expression (new CCodeAssignment (len_dest, len_src));
+                                                       ccode.add_assignment (len_dest, len_src);
                                                }
                                        }
                                }
index aa91761cf7b58599ae5813d7868660233e13d9c5..ce249872c456eb19ab1a99e787f3ecbbad200be9 100644 (file)
@@ -23,7 +23,7 @@
 public class Vala.DovaArrayModule : DovaMethodCallModule {
        void append_initializer_list (CCodeExpression name_cnode, InitializerList initializer_list, ref int i) {
                foreach (Expression e in initializer_list.get_initializers ()) {
-                       ccode.add_expression (new CCodeAssignment (new CCodeElementAccess (name_cnode, new CCodeConstant (i.to_string ())), get_cvalue (e)));
+                       ccode.add_assignment (new CCodeElementAccess (name_cnode, new CCodeConstant (i.to_string ())), get_cvalue (e));
                        i++;
                }
        }
@@ -59,7 +59,7 @@ public class Vala.DovaArrayModule : DovaMethodCallModule {
 
                emit_temp_var (temp_var);
 
-               ccode.add_expression (new CCodeAssignment (name_cnode, array_new));
+               ccode.add_assignment (name_cnode, array_new);
 
                set_cvalue (expr, name_cnode);
        }
index 777ac6fb6f049edaff8aa1fb826433de12848a97..cf94b79d16fb3406d9d54ea60422005029332737 100644 (file)
@@ -37,13 +37,13 @@ public class Vala.DovaAssignmentModule : DovaMemberAccessModule {
                                string lhs_temp_name = "_tmp%d_".printf (next_temp_var_id++);
                                var lhs_temp = new LocalVariable (lhs_value_type, "*" + lhs_temp_name);
                                emit_temp_var (lhs_temp);
-                               ccode.add_expression (new CCodeAssignment (get_variable_cexpression (lhs_temp_name), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, lhs)));
+                               ccode.add_assignment (get_variable_cexpression (lhs_temp_name), new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, lhs));
                                lhs = new CCodeParenthesizedExpression (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (lhs_temp_name)));
                        }
 
                        var temp_decl = get_temp_variable (assignment.left.value_type);
                        emit_temp_var (temp_decl);
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), rhs));
+                       ccode.add_assignment (get_variable_cexpression (temp_decl.name), rhs);
                        if (unref_old) {
                                /* unref old value */
                                ccode.add_expression (get_unref_expression (lhs, assignment.left.value_type, assignment.left));
@@ -138,7 +138,7 @@ public class Vala.DovaAssignmentModule : DovaMemberAccessModule {
                        ccode.add_expression (destroy_value (lvalue));
                }
 
-               ccode.add_expression (new CCodeAssignment (get_cvalue_ (lvalue), get_cvalue_ (value)));
+               ccode.add_assignment (get_cvalue_ (lvalue), get_cvalue_ (value));
        }
 
        public override void store_local (LocalVariable local, TargetValue value) {
index 44a22ab8bbff61a9d55c6689d51a43f7e60bd327..3ddf0e7195341f1c4873edbd1062957d4c2c2bb5 100644 (file)
@@ -625,7 +625,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
                        param.captured = true;
                }
 
-               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_variable_cname (param.name)), cparam));
+               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_variable_cname (param.name)), cparam);
 
                if (requires_destroy (param_type)) {
                        var ma = new MemberAccess.simple (param.name);
@@ -864,7 +864,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 
                if (local.captured) {
                        if (local.initializer != null) {
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id ((Block) local.parent_symbol))), get_variable_cname (local.name)), rhs));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (get_block_id ((Block) local.parent_symbol))), get_variable_cname (local.name)), rhs);
                        }
                } else {
                        var cvar = new CCodeVariableDeclarator (get_variable_cname (local.name), rhs, local.variable_type.get_cdeclarator_suffix ());
@@ -1356,7 +1356,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
                        // assign current value to temp variable
                        var temp_decl = get_temp_variable (prop.property_type, true, expr);
                        emit_temp_var (temp_decl);
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner)));
+                       ccode.add_assignment (get_variable_cexpression (temp_decl.name), get_cvalue (expr.inner));
 
                        // increment/decrement property
                        var op = expr.increment ? CCodeBinaryOperator.PLUS : CCodeBinaryOperator.MINUS;
@@ -1661,7 +1661,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
                        if (expr.type_reference.data_type is Struct) {
                                ccode.add_expression (creation_expr);
                        } else {
-                               ccode.add_expression (new CCodeAssignment (instance, creation_expr));
+                               ccode.add_assignment (instance, creation_expr);
                        }
 
                        foreach (MemberInitializer init in expr.get_object_initializer ()) {
@@ -1675,7 +1675,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
                                        } else {
                                                lhs = new CCodeMemberAccess.pointer (typed_inst, f.get_cname ());
                                        }
-                                       ccode.add_expression (new CCodeAssignment (lhs, get_cvalue (init.initializer)));
+                                       ccode.add_assignment (lhs, get_cvalue (init.initializer));
                                } else if (init.symbol_reference is Property) {
                                        var inst_ma = new MemberAccess.simple ("new");
                                        inst_ma.value_type = expr.type_reference;
@@ -1693,7 +1693,7 @@ public abstract class Vala.DovaBaseModule : CodeGenerator {
 
                        emit_temp_var (temp_var);
 
-                       ccode.add_expression (new CCodeAssignment (temp_ref, creation_expr));
+                       ccode.add_assignment (temp_ref, creation_expr);
                        set_cvalue (expr, temp_ref);
                }
        }
index 6813ca777888e78e4c75d258bee6d1d94af9c9d0..c0df425131edaf271f584f9dbee67cc25be18ead 100644 (file)
@@ -27,7 +27,7 @@ public class Vala.DovaErrorModule : DovaDelegateModule {
        private bool is_in_catch = false;
 
        public override void visit_throw_statement (ThrowStatement stmt) {
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("dova_error"), get_cvalue (stmt.error_expression)));
+               ccode.add_assignment (new CCodeIdentifier ("dova_error"), get_cvalue (stmt.error_expression));
 
                add_simple_check (stmt, true);
        }
index 5490a61547743a64a170146e3bc8f972abbcdc4d..bb5d4702fa64e4d93e14cd709d589a9cd601ec20 100644 (file)
@@ -226,7 +226,7 @@ public class Vala.DovaMethodCallModule : DovaAssignmentModule {
 
                        emit_temp_var (temp_var);
 
-                       ccode.add_expression (new CCodeAssignment (temp_ref, ccall_expr));
+                       ccode.add_assignment (temp_ref, ccall_expr);
                        set_cvalue (expr, temp_ref);
                }
        }
index 6ffc95c7d719a25bd153c7d46784ba3782f18988..66468970920012438e828ff47cf196ba5b8dc2e6 100644 (file)
@@ -1245,7 +1245,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 
                        vcast = get_type_private_from_type ((ObjectTypeSymbol) prop.parent_symbol, new CCodeIdentifier ("type"));
 
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (vcast, "%s_%s".printf (acc.readable ? "get" : "set", prop.name)), new CCodeIdentifier ("function")));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (vcast, "%s_%s".printf (acc.readable ? "get" : "set", prop.name)), new CCodeIdentifier ("function"));
 
                        pop_function ();
 
@@ -1982,7 +1982,7 @@ public class Vala.DovaObjectModule : DovaArrayModule {
                        var lhs = new CCodeIdentifier (field.get_cname ());
                        var rhs = get_cvalue (field.initializer);
 
-                       ccode.add_expression (new CCodeAssignment (lhs, rhs));
+                       ccode.add_assignment (lhs, rhs);
                }
        }
 }
index 0e3ae10662247640c6284ebda93eb85d3a60e30c..9f78a9861eea53c93cdccf352e8ee70e915c3b80 100644 (file)
@@ -184,7 +184,7 @@ public class Vala.GAsyncModule : GSignalModule {
                        var self_target_type = new ObjectType (type_symbol);
                        var cself = transform_expression (new CCodeIdentifier ("base"), base_expression_type, self_target_type);
                        ccode.add_declaration ("%s *".printf (type_symbol.get_cname ()), new CCodeVariableDeclarator ("self"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), cself));
+                       ccode.add_assignment (new CCodeIdentifier ("self"), cself);
                }
 
                var dataalloc = new CCodeFunctionCall (new CCodeIdentifier ("g_slice_new0"));
@@ -193,7 +193,7 @@ public class Vala.GAsyncModule : GSignalModule {
                var data_var = new CCodeIdentifier ("_data_");
 
                ccode.add_declaration (dataname + "*", new CCodeVariableDeclarator ("_data_"));
-               ccode.add_expression (new CCodeAssignment (data_var, dataalloc));
+               ccode.add_assignment (data_var, dataalloc);
 
                var create_result = new CCodeFunctionCall (new CCodeIdentifier ("g_simple_async_result_new"));
 
@@ -221,7 +221,7 @@ public class Vala.GAsyncModule : GSignalModule {
                create_result.add_argument (new CCodeIdentifier ("_user_data_"));
                create_result.add_argument (new CCodeIdentifier (m.get_real_cname ()));
 
-               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, "_async_result"), create_result));
+               ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, "_async_result"), create_result);
 
                var set_op_res_call = new CCodeFunctionCall (new CCodeIdentifier ("g_simple_async_result_set_op_res_gpointer"));
                set_op_res_call.add_argument (new CCodeMemberAccess.pointer (data_var, "_async_result"));
@@ -246,7 +246,7 @@ public class Vala.GAsyncModule : GSignalModule {
                                cself = get_ref_cexpression (m.this_parameter.variable_type, cself, ma, m.this_parameter);
                        }
 
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, "self"), cself));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, "self"), cself);
                }
 
                foreach (Parameter param in m.get_parameters ()) {
@@ -267,20 +267,20 @@ public class Vala.GAsyncModule : GSignalModule {
                                        cparam = get_ref_cexpression (param.variable_type, cparam, ma, param);
                                }
 
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)), cparam));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)), cparam);
                                if (param.variable_type is ArrayType) {
                                        var array_type = (ArrayType) param.variable_type;
                                        if (!param.no_array_length) {
                                                for (int dim = 1; dim <= array_type.rank; dim++) {
-                                                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, get_parameter_array_length_cname (param, dim)), new CCodeIdentifier (get_parameter_array_length_cname (param, dim))));
+                                                       ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, get_parameter_array_length_cname (param, dim)), new CCodeIdentifier (get_parameter_array_length_cname (param, dim)));
                                                }
                                        }
                                } else if (param.variable_type is DelegateType) {
                                        var deleg_type = (DelegateType) param.variable_type;
                                        if (deleg_type.delegate_symbol.has_target) {
-                                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, get_delegate_target_cname (get_variable_cname (param.name))), new CCodeIdentifier (get_delegate_target_cname (get_variable_cname (param.name)))));
+                                               ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, get_delegate_target_cname (get_variable_cname (param.name))), new CCodeIdentifier (get_delegate_target_cname (get_variable_cname (param.name))));
                                                if (deleg_type.value_owned) {
-                                                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, get_delegate_target_destroy_notify_cname (get_variable_cname (param.name))), new CCodeIdentifier (get_delegate_target_destroy_notify_cname (get_variable_cname (param.name)))));
+                                                       ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, get_delegate_target_destroy_notify_cname (get_variable_cname (param.name))), new CCodeIdentifier (get_delegate_target_destroy_notify_cname (get_variable_cname (param.name))));
                                                }
                                        }
                                }
@@ -437,13 +437,13 @@ public class Vala.GAsyncModule : GSignalModule {
 
                var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_simple_async_result_get_op_res_gpointer"));
                ccall.add_argument (simple_async_result_cast);
-               ccode.add_expression (new CCodeAssignment (data_var, ccall));
+               ccode.add_assignment (data_var, ccall);
 
                foreach (Parameter param in m.get_parameters ()) {
                        if (param.direction != ParameterDirection.IN) {
-                               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (param.name)), new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name))));
+                               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (param.name)), new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)));
                                if (!(param.variable_type is ValueType) || param.variable_type.nullable) {
-                                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)), new CCodeConstant ("NULL")));
+                                       ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)), new CCodeConstant ("NULL"));
                                }
                        }
                }
@@ -454,21 +454,21 @@ public class Vala.GAsyncModule : GSignalModule {
                        if (requires_copy (return_type)) {
                                cexpr = get_ref_cexpression (return_type, cexpr, null, return_type);
                        }
-                       ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result")), cexpr));
+                       ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result")), cexpr);
                } else if (!(return_type is VoidType)) {
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("result"), new CCodeMemberAccess.pointer (data_var, "result")));
+                       ccode.add_assignment (new CCodeIdentifier ("result"), new CCodeMemberAccess.pointer (data_var, "result"));
                        if (return_type is ArrayType) {
                                var array_type = (ArrayType) return_type;
                                if (!m.no_array_length) {
                                        for (int dim = 1; dim <= array_type.rank; dim++) {
-                                               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (get_array_length_cname ("result", dim))), new CCodeMemberAccess.pointer (data_var, get_array_length_cname ("result", dim))));
+                                               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (get_array_length_cname ("result", dim))), new CCodeMemberAccess.pointer (data_var, get_array_length_cname ("result", dim)));
                                        }
                                }
                        } else if (return_type is DelegateType && ((DelegateType) return_type).delegate_symbol.has_target) {
-                               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (get_delegate_target_cname ("result"))), new CCodeMemberAccess.pointer (data_var, get_delegate_target_cname ("result"))));
+                               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (get_delegate_target_cname ("result"))), new CCodeMemberAccess.pointer (data_var, get_delegate_target_cname ("result")));
                        }
                        if (!(return_type is ValueType) || return_type.nullable) {
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, "result"), new CCodeConstant ("NULL")));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (data_var, "result"), new CCodeConstant ("NULL"));
                        }
                        ccode.add_return (new CCodeIdentifier ("result"));
                }
@@ -563,7 +563,7 @@ public class Vala.GAsyncModule : GSignalModule {
                if (stmt.yield_expression == null) {
                        int state = next_coroutine_state++;
 
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ())));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ()));
                        ccode.add_return (new CCodeConstant ("FALSE"));
                        ccode.add_label ("_state_%d".printf (state));
                        ccode.add_statement (new CCodeEmptyStatement ());
index 314033966fd8ff94c8296290d18937020b754a5a..666ac198880612c045b11b719f4941893fe2ef67 100644 (file)
@@ -316,7 +316,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                        if (expr.is_yield_expression) {
                                int state = next_coroutine_state++;
 
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ())));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), "_state_"), new CCodeConstant (state.to_string ()));
                                ccode.add_expression (ccall);
                                ccode.add_return (new CCodeConstant ("FALSE"));
                                ccode.add_label ("_state_%d".printf (state));
@@ -334,7 +334,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                emit_temp_var (temp_var);
 
-               ccode.add_expression (new CCodeAssignment (temp_ref, ccall));
+               ccode.add_assignment (temp_ref, ccall);
                set_cvalue (expr, temp_ref);
        }
 
@@ -498,7 +498,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                                ccall.add_argument (interface_name);
                        }
                        ccall.add_argument (new CCodeConstant ("\"%s\"".printf (method_name)));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_message"), ccall));
+                       ccode.add_assignment (new CCodeIdentifier ("_message"), ccall);
 
                        ccode.add_declaration ("GVariant", new CCodeVariableDeclarator ("*_arguments"));
                        ccode.add_declaration ("GVariantBuilder", new CCodeVariableDeclarator ("_arguments_builder"));
@@ -510,7 +510,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                        if (uses_fd) {
                                ccode.add_declaration ("GUnixFDList", new CCodeVariableDeclarator ("*_fd_list"));
-                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_fd_list"), new CCodeFunctionCall (new CCodeIdentifier ("g_unix_fd_list_new"))));
+                               ccode.add_assignment (new CCodeIdentifier ("_fd_list"), new CCodeFunctionCall (new CCodeIdentifier ("g_unix_fd_list_new")));
                        }
 
                        CCodeExpression cancellable = new CCodeConstant ("NULL");
@@ -538,7 +538,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                        var builder_end = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_end"));
                        builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("_arguments_builder")));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_arguments"), builder_end));
+                       ccode.add_assignment (new CCodeIdentifier ("_arguments"), builder_end);
 
                        var set_body = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_message_set_body"));
                        set_body.add_argument (new CCodeIdentifier ("_message"));
@@ -567,7 +567,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                                ccall.add_argument (new CCodeConstant ("NULL"));
                                ccall.add_argument (cancellable);
                                ccall.add_argument (new CCodeIdentifier ("error"));
-                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply_message"), ccall));
+                               ccode.add_assignment (new CCodeIdentifier ("_reply_message"), ccall);
                        } else if (call_type == CallType.NO_REPLY) {
                                var set_flags = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_message_set_flags"));
                                set_flags.add_argument (new CCodeIdentifier ("_message"));
@@ -617,7 +617,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                        ccall.add_argument (inner_res);
 
                        ccall.add_argument (new CCodeConstant ("error"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply_message"), ccall));
+                       ccode.add_assignment (new CCodeIdentifier ("_reply_message"), ccall);
                }
 
                if (call_type == CallType.SYNC || call_type == CallType.FINISH) {
@@ -659,7 +659,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                                ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_message_get_body"));
                                ccall.add_argument (new CCodeIdentifier ("_reply_message"));
-                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply"), ccall));
+                               ccode.add_assignment (new CCodeIdentifier ("_reply"), ccall);
 
                                var iter_init = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_iter_init"));
                                iter_init.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("_reply_iter")));
@@ -684,12 +684,12 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                                                // TODO check that parameter is not NULL (out parameters are optional)
                                                // free value if parameter is NULL
-                                               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (param.name)), target));
+                                               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (param.name)), target);
 
                                                if (array_type != null) {
                                                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                                                // TODO check that parameter is not NULL (out parameters are optional)
-                                                               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("%s_length%d".printf (param.name, dim))), new CCodeIdentifier ("_%s_length%d".printf (param.name, dim))));
+                                                               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("%s_length%d".printf (param.name, dim))), new CCodeIdentifier ("_%s_length%d".printf (param.name, dim)));
                                                        }
                                                }
 
@@ -723,7 +723,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                                                if (array_type != null) {
                                                        for (int dim = 1; dim <= array_type.rank; dim++) {
                                                                // TODO check that parameter is not NULL (out parameters are optional)
-                                                               ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result_length%d".printf (dim))), new CCodeIdentifier ("_result_length%d".printf (dim))));
+                                                               ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result_length%d".printf (dim))), new CCodeIdentifier ("_result_length%d".printf (dim)));
                                                        }
                                                }
 
@@ -860,7 +860,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_proxy_get_cached_property"));
                ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier ("self"), "GDBusProxy *"));
                ccall.add_argument (new CCodeConstant ("\"%s\"".printf (get_dbus_name_for_member (prop))));
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_inner_reply"), ccall));
+               ccode.add_assignment (new CCodeIdentifier ("_inner_reply"), ccall);
 
                // if not successful, retrieve value via D-Bus
                ccode.open_if (new CCodeUnaryExpression (CCodeUnaryOperator.LOGICAL_NEGATION, new CCodeIdentifier ("_inner_reply")));
@@ -881,7 +881,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                var builder_end = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_end"));
                builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("_arguments_builder")));
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_arguments"), builder_end));
+               ccode.add_assignment (new CCodeIdentifier ("_arguments"), builder_end);
 
                ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_proxy_call_sync"));
                ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier ("self"), "GDBusProxy *"));
@@ -892,7 +892,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                ccall.add_argument (new CCodeConstant ("NULL"));
                ccall.add_argument (new CCodeConstant ("NULL"));
 
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply"), ccall));
+               ccode.add_assignment (new CCodeIdentifier ("_reply"), ccall);
 
                // return on error
                ccode.open_if (new CCodeUnaryExpression (CCodeUnaryOperator.LOGICAL_NEGATION, new CCodeIdentifier ("_reply")));
@@ -914,7 +914,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                if (prop.property_type.is_real_non_null_struct_type ()) {
                        var target = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result"));
                        var result = deserialize_expression (prop.get_accessor.value_type, new CCodeIdentifier ("_inner_reply"), target);
-                       ccode.add_expression (new CCodeAssignment (target, result));
+                       ccode.add_assignment (target, result);
                } else {
                        ccode.add_declaration (prop.get_accessor.value_type.get_cname (), new CCodeVariableDeclarator ("_result"));
 
@@ -925,12 +925,12 @@ public class Vala.GDBusClientModule : GDBusModule {
                        }
 
                        var result = deserialize_expression (prop.get_accessor.value_type, new CCodeIdentifier ("_inner_reply"), new CCodeIdentifier ("_result"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_result"), result));
+                       ccode.add_assignment (new CCodeIdentifier ("_result"), result);
 
                        if (array_type != null) {
                                for (int dim = 1; dim <= array_type.rank; dim++) {
                                        // TODO check that parameter is not NULL (out parameters are optional)
-                                       ccode.add_expression (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result_length%d".printf (dim))), new CCodeIdentifier ("_result_length%d".printf (dim))));
+                                       ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result_length%d".printf (dim))), new CCodeIdentifier ("_result_length%d".printf (dim)));
                                }
                        }
                }
@@ -1012,7 +1012,7 @@ public class Vala.GDBusClientModule : GDBusModule {
 
                var builder_end = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_end"));
                builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("_arguments_builder")));
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_arguments"), builder_end));
+               ccode.add_assignment (new CCodeIdentifier ("_arguments"), builder_end);
 
                var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_proxy_call_sync"));
                ccall.add_argument (new CCodeCastExpression (new CCodeIdentifier ("self"), "GDBusProxy *"));
@@ -1023,7 +1023,7 @@ public class Vala.GDBusClientModule : GDBusModule {
                ccall.add_argument (new CCodeConstant ("NULL"));
                ccall.add_argument (new CCodeConstant ("NULL"));
 
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply"), ccall));
+               ccode.add_assignment (new CCodeIdentifier ("_reply"), ccall);
 
                // return on error
                ccode.open_if (new CCodeUnaryExpression (CCodeUnaryOperator.LOGICAL_NEGATION, new CCodeIdentifier ("_reply")));
index 2074687bb5f0d420459f4fd03b4db59f6d038eaf..9f1328108d2c97592fbb97ae973287573bb4426c 100644 (file)
@@ -217,7 +217,7 @@ public class Vala.GDBusModule : GVariantModule {
                        get_fd.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("_fd_index")));
                        ccode.add_expression (get_fd);
 
-                       ccode.add_expression (new CCodeAssignment (target_expr, stream));
+                       ccode.add_assignment (target_expr, stream);
                } else {
                        read_expression (type, iter_expr, target_expr, sym, error_expr, out may_fail);
                }
index a32100f3cb223bfb9b168befd1c9e71a01b93aaf..7514c1d9ae3a2a160370333d8617f02871b640e6 100644 (file)
@@ -243,7 +243,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                        if (m.return_type is VoidType || m.return_type.is_real_non_null_struct_type ()) {
                                ccode.add_expression (ccall);
                        } else {
-                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("result"), ccall));
+                               ccode.add_assignment (new CCodeIdentifier ("result"), ccall);
                        }
 
                        if (m.get_error_types ().size > 0) {
@@ -266,7 +266,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                        ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_message_new_method_reply"));
                        ccall.add_argument (message_expr);
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply_message"), ccall));
+                       ccode.add_assignment (new CCodeIdentifier ("_reply_message"), ccall);
 
                        ccode.add_declaration ("GVariant*", new CCodeVariableDeclarator ("_reply"));
                        ccode.add_declaration ("GVariantBuilder", new CCodeVariableDeclarator ("_reply_builder"));
@@ -278,7 +278,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                        if (uses_fd) {
                                ccode.add_declaration ("GUnixFDList", new CCodeVariableDeclarator ("*_fd_list"));
-                               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_fd_list"), new CCodeFunctionCall (new CCodeIdentifier ("g_unix_fd_list_new"))));
+                               ccode.add_assignment (new CCodeIdentifier ("_fd_list"), new CCodeFunctionCall (new CCodeIdentifier ("g_unix_fd_list_new")));
                        }
 
                        foreach (Parameter param in m.get_parameters ()) {
@@ -350,7 +350,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                        var builder_end = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_end"));
                        builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("_reply_builder")));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply"), builder_end));
+                       ccode.add_assignment (new CCodeIdentifier ("_reply"), builder_end);
 
                        var set_body = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_message_set_body"));
                        set_body.add_argument (new CCodeIdentifier ("_reply_message"));
@@ -471,7 +471,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                var builder_end = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_end"));
                builder_end.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("_arguments_builder")));
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_arguments"), builder_end));
+               ccode.add_assignment (new CCodeIdentifier ("_arguments"), builder_end);
 
                var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_dbus_connection_emit_signal"));
                ccall.add_argument (new CCodeIdentifier ("_connection"));
@@ -510,7 +510,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                        ccode.add_expression (ccall);
                } else {
                        ccode.add_declaration (prop.get_accessor.value_type.get_cname (), new CCodeVariableDeclarator ("result"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("result"), ccall));
+                       ccode.add_assignment (new CCodeIdentifier ("result"), ccall);
 
                        var array_type = prop.get_accessor.value_type as ArrayType;
                        if (array_type != null) {
@@ -526,7 +526,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                var reply_expr = serialize_expression (prop.get_accessor.value_type, new CCodeIdentifier ("result"));
 
                ccode.add_declaration ("GVariant*", new CCodeVariableDeclarator ("_reply"));
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_reply"), reply_expr));
+               ccode.add_assignment (new CCodeIdentifier ("_reply"), reply_expr);
 
                if (requires_destroy (prop.get_accessor.value_type)) {
                        // keep local alive (symbol_reference is weak)
@@ -585,7 +585,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                var target = new CCodeIdentifier ("value");
                var expr = deserialize_expression (prop.property_type, new CCodeIdentifier ("_value"), target);
-               ccode.add_expression (new CCodeAssignment (target, expr));
+               ccode.add_assignment (target, expr);
 
                ccode.add_expression (ccall);
 
@@ -1080,7 +1080,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
                get_qdata.add_argument (quark);
 
                ccode.add_declaration ("void", new CCodeVariableDeclarator ("*func"));
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("func"), get_qdata));
+               ccode.add_assignment (new CCodeIdentifier ("func"), get_qdata);
 
                ccode.open_if (new CCodeUnaryExpression (CCodeUnaryOperator.LOGICAL_NEGATION, new CCodeIdentifier ("func")));
                // no D-Bus interface
@@ -1161,7 +1161,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
 
                        emit_temp_var (temp_var);
 
-                       ccode.add_expression (new CCodeAssignment (temp_ref, cregister));
+                       ccode.add_assignment (temp_ref, cregister);
                        set_cvalue (expr, temp_ref);
                }
        }
index 4d464ef984369b8a509c9e7dbab486e05c68fdbf..7329582d8ff0b33841e076af10d31b216471d5cd 100644 (file)
@@ -87,7 +87,7 @@ public class Vala.GErrorModule : CCodeDelegateModule {
        public override void visit_throw_statement (ThrowStatement stmt) {
                // method will fail
                current_method_inner_error = true;
-               ccode.add_expression (new CCodeAssignment (get_variable_cexpression ("_inner_error_"), get_cvalue (stmt.error_expression)));
+               ccode.add_assignment (get_variable_cexpression ("_inner_error_"), get_cvalue (stmt.error_expression));
 
                add_simple_check (stmt, true);
        }
@@ -358,14 +358,14 @@ public class Vala.GErrorModule : CCodeDelegateModule {
                        } else {
                                ccode.add_declaration ("GError *", new CCodeVariableDeclarator (variable_name));
                        }
-                       ccode.add_expression (new CCodeAssignment (get_variable_cexpression (variable_name), get_variable_cexpression ("_inner_error_")));
+                       ccode.add_assignment (get_variable_cexpression (variable_name), get_variable_cexpression ("_inner_error_"));
                } else {
                        // error object is not used within catch statement, clear it
                        var cclear = new CCodeFunctionCall (new CCodeIdentifier ("g_clear_error"));
                        cclear.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression ("_inner_error_")));
                        ccode.add_expression (cclear);
                }
-               ccode.add_expression (new CCodeAssignment (get_variable_cexpression ("_inner_error_"), new CCodeConstant ("NULL")));
+               ccode.add_assignment (get_variable_cexpression ("_inner_error_"), new CCodeConstant ("NULL"));
 
                clause.body.emit (this);
 
index 2159941b917d8335d50d5ea2ffcecb208ab7d4a8..6431bdfe848d74ceefbc4c912539a6fcc84fd514 100644 (file)
@@ -51,24 +51,24 @@ public class Vala.GObjectModule : GTypeModule {
                var ccall = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
                ccall.add_argument (new CCodeIdentifier ("klass"));
                if (class_has_readable_properties (cl) || cl.get_type_parameters ().size > 0) {
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccall, "get_property"), new CCodeIdentifier ("_vala_%s_get_property".printf (cl.get_lower_case_cname (null)))));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (ccall, "get_property"), new CCodeIdentifier ("_vala_%s_get_property".printf (cl.get_lower_case_cname (null))));
                }
                if (class_has_writable_properties (cl) || cl.get_type_parameters ().size > 0) {
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccall, "set_property"), new CCodeIdentifier ("_vala_%s_set_property".printf (cl.get_lower_case_cname (null)))));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (ccall, "set_property"), new CCodeIdentifier ("_vala_%s_set_property".printf (cl.get_lower_case_cname (null))));
                }
        
                /* set constructor */
                if (cl.constructor != null) {
                        var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
                        ccast.add_argument (new CCodeIdentifier ("klass"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, "constructor"), new CCodeIdentifier ("%s_constructor".printf (cl.get_lower_case_cname (null)))));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, "constructor"), new CCodeIdentifier ("%s_constructor".printf (cl.get_lower_case_cname (null))));
                }
 
                /* set finalize function */
                if (cl.get_fields ().size > 0 || cl.destructor != null) {
                        var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
                        ccast.add_argument (new CCodeIdentifier ("klass"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, "finalize"), new CCodeIdentifier ("%s_finalize".printf (cl.get_lower_case_cname (null)))));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, "finalize"), new CCodeIdentifier ("%s_finalize".printf (cl.get_lower_case_cname (null))));
                }
 
                /* create type, dup_func, and destroy_func properties for generic types */
@@ -445,19 +445,19 @@ public class Vala.GObjectModule : GTypeModule {
 
                        var ccast = new CCodeFunctionCall (new CCodeIdentifier ("G_OBJECT_CLASS"));
                        ccast.add_argument (new CCodeIdentifier ("%s_parent_class".printf (cl.get_lower_case_cname (null))));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("parent_class"), ccast));
+                       ccode.add_assignment (new CCodeIdentifier ("parent_class"), ccast);
 
                        var ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (new CCodeIdentifier ("parent_class"), "constructor"));
                        ccall.add_argument (new CCodeIdentifier ("type"));
                        ccall.add_argument (new CCodeIdentifier ("n_construct_properties"));
                        ccall.add_argument (new CCodeIdentifier ("construct_properties"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("obj"), ccall));
+                       ccode.add_assignment (new CCodeIdentifier ("obj"), ccall);
 
 
                        ccall = generate_instance_cast (new CCodeIdentifier ("obj"), cl);
 
                        ccode.add_declaration ("%s *".printf (cl.get_cname ()), new CCodeVariableDeclarator ("self"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), ccall));
+                       ccode.add_assignment (new CCodeIdentifier ("self"), ccall);
 
                        c.body.emit (this);
 
index 4de1d4b4c07c5301bb7de9c4116746caa0756417..fd55878f842fd530db0d0c38a600300727f133e7 100644 (file)
@@ -771,7 +771,7 @@ public class Vala.GSignalModule : GObjectModule {
 
                        emit_temp_var (temp_var);
 
-                       ccode.add_expression (new CCodeAssignment (temp_ref, ccall));
+                       ccode.add_assignment (temp_ref, ccall);
 
                        return temp_ref;
                }
index 3c1082d8d0b5cb288f79c3f862ef80651ffbb2f8..fc777801a8e3ced5f393696fa4475b99749a6aaf 100644 (file)
@@ -1252,10 +1252,10 @@ public class Vala.GTypeModule : GErrorModule {
                                var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (((Class) base_type).get_upper_case_cname (null))));
                                ccast.add_argument (new CCodeIdentifier ("klass"));
 
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, m.base_method.vfunc_name), new CCodeIdentifier (m.get_real_cname ())));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, m.base_method.vfunc_name), new CCodeIdentifier (m.get_real_cname ()));
 
                                if (m.coroutine) {
-                                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, m.base_method.get_finish_vfunc_name ()), new CCodeIdentifier (m.get_finish_real_cname ())));
+                                       ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, m.base_method.get_finish_vfunc_name ()), new CCodeIdentifier (m.get_finish_real_cname ()));
                                }
                        }
                }
@@ -1267,7 +1267,7 @@ public class Vala.GTypeModule : GErrorModule {
                        }
                        var ccast = new CCodeFunctionCall (new CCodeIdentifier ("%s_CLASS".printf (cl.get_upper_case_cname (null))));
                        ccast.add_argument (new CCodeIdentifier ("klass"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, sig.default_handler.vfunc_name), new CCodeIdentifier (sig.default_handler.get_real_cname ())));
+                       ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, sig.default_handler.vfunc_name), new CCodeIdentifier (sig.default_handler.get_real_cname ()));
                }
 
                /* connect overridden properties */
@@ -1282,11 +1282,11 @@ public class Vala.GTypeModule : GErrorModule {
 
                        if (prop.get_accessor != null) {
                                string cname = "%s_real_get_%s".printf (cl.get_lower_case_cname (null), prop.name);
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, "get_%s".printf (prop.name)), new CCodeIdentifier (cname)));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, "get_%s".printf (prop.name)), new CCodeIdentifier (cname));
                        }
                        if (prop.set_accessor != null) {
                                string cname = "%s_real_set_%s".printf (cl.get_lower_case_cname (null), prop.name);
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ccast, "set_%s".printf (prop.name)), new CCodeIdentifier (cname)));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (ccast, "set_%s".printf (prop.name)), new CCodeIdentifier (cname));
                        }
                }
 
@@ -1538,7 +1538,7 @@ public class Vala.GTypeModule : GErrorModule {
                if (!cl.is_compact && (cl.has_private_fields || cl.get_type_parameters ().size > 0)) {
                        var ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (cl.get_upper_case_cname (null))));
                        ccall.add_argument (new CCodeIdentifier ("self"));
-                       func.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), ccall));
+                       func.add_assignment (new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), "priv"), ccall);
                }
 
                pop_context ();
@@ -1633,7 +1633,7 @@ public class Vala.GTypeModule : GErrorModule {
                        CCodeFunctionCall ccall = generate_instance_cast (new CCodeIdentifier ("obj"), cl);
 
                        ccode.add_declaration ("%s *".printf (cl.get_cname ()), new CCodeVariableDeclarator ("self"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("self"), ccall));
+                       ccode.add_assignment (new CCodeIdentifier ("self"), ccall);
                } else {
                        var function = new CCodeFunction (cl.get_lower_case_cprefix () + "free", "void");
                        if (cl.access == SymbolAccessibility.PRIVATE) {
@@ -2021,7 +2021,7 @@ public class Vala.GTypeModule : GErrorModule {
                ccode.add_declaration (bool_type.get_cname (), new CCodeVariableDeclarator ("initialized", new CCodeConstant ("FALSE")), CCodeModifiers.STATIC);
                ccode.open_if (new CCodeUnaryExpression (CCodeUnaryOperator.LOGICAL_NEGATION, new CCodeIdentifier ("initialized")));
 
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("initialized"), new CCodeConstant ("TRUE")));
+               ccode.add_assignment (new CCodeIdentifier ("initialized"), new CCodeConstant ("TRUE"));
 
                if (iface.is_subtype_of (gobject_type)) {
                        /* create properties */
@@ -2058,7 +2058,7 @@ public class Vala.GTypeModule : GErrorModule {
                        if (m.is_virtual) {
                                var ciface = new CCodeIdentifier ("iface");
                                var cname = m.get_real_cname ();
-                               ccode.add_expression (new CCodeAssignment (new CCodeMemberAccess.pointer (ciface, m.vfunc_name), new CCodeIdentifier (cname)));
+                               ccode.add_assignment (new CCodeMemberAccess.pointer (ciface, m.vfunc_name), new CCodeIdentifier (cname));
                        }
                }
 
index 9a5fe30f440e4cec22f3d1c1833450847ba85886..6e87eb06aafcdcef1eb6d78e031bea01a8a87412 100644 (file)
@@ -305,7 +305,7 @@ public class Vala.GVariantModule : GAsyncModule {
                        // NULL terminate array
                        var length = new CCodeIdentifier (temp_name + "_length");
                        var element_access = new CCodeElementAccess (new CCodeIdentifier (temp_name), length);
-                       ccode.add_expression (new CCodeAssignment (element_access, new CCodeIdentifier ("NULL")));
+                       ccode.add_assignment (element_access, new CCodeIdentifier ("NULL"));
                }
 
                return new CCodeIdentifier (temp_name);
@@ -340,20 +340,20 @@ public class Vala.GVariantModule : GAsyncModule {
 
                        // tmp_size = (2 * tmp_size);
                        var new_size = new CCodeBinaryExpression (CCodeBinaryOperator.MUL, new CCodeConstant ("2"), new CCodeIdentifier (temp_name + "_size"));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier (temp_name + "_size"), new_size));
+                       ccode.add_assignment (new CCodeIdentifier (temp_name + "_size"), new_size);
 
                        var renew_call = new CCodeFunctionCall (new CCodeIdentifier ("g_renew"));
                        renew_call.add_argument (new CCodeIdentifier (array_type.element_type.get_cname ()));
                        renew_call.add_argument (new CCodeIdentifier (temp_name));
                        // add one extra element for NULL-termination
                        renew_call.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier (temp_name + "_size"), new CCodeConstant ("1")));
-                       ccode.add_expression (new CCodeAssignment (new CCodeIdentifier (temp_name), renew_call));
+                       ccode.add_assignment (new CCodeIdentifier (temp_name), renew_call);
 
                        ccode.close ();
 
                        var element_access = new CCodeElementAccess (new CCodeIdentifier (temp_name), new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, new CCodeIdentifier (temp_name + "_length")));
                        var element_expr = deserialize_expression (array_type.element_type, new CCodeIdentifier (element_name), null);
-                       ccode.add_expression (new CCodeAssignment (element_access, element_expr));
+                       ccode.add_assignment (element_access, element_expr);
                }
 
                var unref = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_unref"));
@@ -363,7 +363,7 @@ public class Vala.GVariantModule : GAsyncModule {
                ccode.close ();
 
                if (expr != null) {
-                       ccode.add_expression (new CCodeAssignment (get_array_length (expr, dim), new CCodeIdentifier ("%s_length%d".printf (temp_name, dim))));
+                       ccode.add_assignment (get_array_length (expr, dim), new CCodeIdentifier ("%s_length%d".printf (temp_name, dim)));
                }
        }
 
@@ -432,7 +432,7 @@ public class Vala.GVariantModule : GAsyncModule {
                } else {
                        hash_table_new.add_argument (new CCodeIdentifier ("NULL"));
                }
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier (temp_name), hash_table_new));
+               ccode.add_assignment (new CCodeIdentifier (temp_name), hash_table_new);
 
                var iter_call = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_iter_init"));
                iter_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (subiter_name)));
@@ -510,7 +510,7 @@ public class Vala.GVariantModule : GAsyncModule {
 
                if (sym != null && get_dbus_signature (sym) != null) {
                        // raw GVariant
-                       ccode.add_expression (new CCodeAssignment (target_expr, iter_call));
+                       ccode.add_assignment (target_expr, iter_call);
                        return;
                }
 
@@ -520,7 +520,7 @@ public class Vala.GVariantModule : GAsyncModule {
 
                var variant_expr = new CCodeIdentifier (temp_name);
 
-               ccode.add_expression (new CCodeAssignment (variant_expr, iter_call));
+               ccode.add_assignment (variant_expr, iter_call);
 
                var result = deserialize_expression (type, variant_expr, target_expr, error_expr, out may_fail);
                if (result == null) {
@@ -528,7 +528,7 @@ public class Vala.GVariantModule : GAsyncModule {
                        return;
                }
 
-               ccode.add_expression (new CCodeAssignment (target_expr, result));
+               ccode.add_assignment (target_expr, result);
 
                var unref = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_unref"));
                unref.add_argument (variant_expr);
@@ -591,7 +591,7 @@ public class Vala.GVariantModule : GAsyncModule {
                string array_iter_name = "_tmp%d_".printf (next_temp_var_id++);
 
                ccode.add_declaration (array_type.get_cname (), new CCodeVariableDeclarator (array_iter_name));
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier (array_iter_name), array_expr));
+               ccode.add_assignment (new CCodeIdentifier (array_iter_name), array_expr);
 
                return serialize_array_dim (array_type, 1, array_expr, new CCodeIdentifier (array_iter_name));
        }
@@ -711,8 +711,8 @@ public class Vala.GVariantModule : GAsyncModule {
                ccode.add_declaration (key_type.get_cname (), new CCodeVariableDeclarator ("_key"));
                ccode.add_declaration (value_type.get_cname (), new CCodeVariableDeclarator ("_value"));
 
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_key"), convert_from_generic_pointer (new CCodeIdentifier (key_name), key_type)));
-               ccode.add_expression (new CCodeAssignment (new CCodeIdentifier ("_value"), convert_from_generic_pointer (new CCodeIdentifier (value_name), value_type)));
+               ccode.add_assignment (new CCodeIdentifier ("_key"), convert_from_generic_pointer (new CCodeIdentifier (key_name), key_type));
+               ccode.add_assignment (new CCodeIdentifier ("_value"), convert_from_generic_pointer (new CCodeIdentifier (value_name), value_type));
 
                var serialized_key =  serialize_expression (key_type, new CCodeIdentifier ("_key"));
                var serialized_value = serialize_expression (value_type, new CCodeIdentifier ("_value"));