[vala/emit-let: 4/4] codegen: Add CCodeFunction.add_assignment convenience function.
- From: Luca Bruno <lucabru src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/emit-let: 4/4] codegen: Add CCodeFunction.add_assignment convenience function.
- Date: Mon, 17 Jan 2011 09:07:05 +0000 (UTC)
commit ae83e8a6479aa527063cec399478d9da655278c9
Author: Luca Bruno <lucabru src gnome org>
Date: Mon Jan 17 09:58:24 2011 +0100
codegen: Add CCodeFunction.add_assignment convenience function.
ccode/valaccodefunction.vala | 4 +
codegen/valaccodearraymodule.vala | 18 ++--
codegen/valaccodeassignmentmodule.vala | 24 +++---
codegen/valaccodebasemodule.vala | 130 +++++++++++++++---------------
codegen/valaccodecontrolflowmodule.vala | 12 ++--
codegen/valaccodememberaccessmodule.vala | 2 +-
codegen/valaccodemethodcallmodule.vala | 16 ++--
codegen/valaccodemethodmodule.vala | 18 ++--
codegen/valaccodestructmodule.vala | 4 +-
codegen/valadovaarraymodule.vala | 4 +-
codegen/valadovaassignmentmodule.vala | 6 +-
codegen/valadovabasemodule.vala | 12 ++--
codegen/valadovaerrormodule.vala | 2 +-
codegen/valadovamethodcallmodule.vala | 2 +-
codegen/valadovaobjectmodule.vala | 4 +-
codegen/valagasyncmodule.vala | 34 ++++----
codegen/valagdbusclientmodule.vala | 38 +++++-----
codegen/valagdbusmodule.vala | 2 +-
codegen/valagdbusservermodule.vala | 20 +++---
codegen/valagerrormodule.vala | 6 +-
codegen/valagobjectmodule.vala | 14 ++--
codegen/valagsignalmodule.vala | 2 +-
codegen/valagtypemodule.vala | 18 ++--
codegen/valagvariantmodule.vala | 24 +++---
24 files changed, 210 insertions(+), 206 deletions(-)
---
diff --git a/ccode/valaccodefunction.vala b/ccode/valaccodefunction.vala
index 20725ee..f6c0477 100644
--- a/ccode/valaccodefunction.vala
+++ b/ccode/valaccodefunction.vala
@@ -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));
}
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index 1a367f3..1d8d193 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -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 ();
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index 7f20bc3..9c53c5a 100644
--- a/codegen/valaccodeassignmentmodule.vala
+++ b/codegen/valaccodeassignmentmodule.vala
@@ -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));
}
}
}
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index d62afbf..49ba731 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -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);
}
}
}
diff --git a/codegen/valaccodecontrolflowmodule.vala b/codegen/valaccodecontrolflowmodule.vala
index eb8e1ef..b51fe5f 100644
--- a/codegen/valaccodecontrolflowmodule.vala
+++ b/codegen/valaccodecontrolflowmodule.vala
@@ -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);
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 9f038f6..f2058eb 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -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) {
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index cb408aa..e54d79c 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -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));
}
}
}
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 428dac1..0b8c81a 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -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) {
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index 555ef07..5021e7f 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -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);
}
}
}
diff --git a/codegen/valadovaarraymodule.vala b/codegen/valadovaarraymodule.vala
index aa91761..ce24987 100644
--- a/codegen/valadovaarraymodule.vala
+++ b/codegen/valadovaarraymodule.vala
@@ -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);
}
diff --git a/codegen/valadovaassignmentmodule.vala b/codegen/valadovaassignmentmodule.vala
index 777ac6f..cf94b79 100644
--- a/codegen/valadovaassignmentmodule.vala
+++ b/codegen/valadovaassignmentmodule.vala
@@ -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) {
diff --git a/codegen/valadovabasemodule.vala b/codegen/valadovabasemodule.vala
index 44a22ab..3ddf0e7 100644
--- a/codegen/valadovabasemodule.vala
+++ b/codegen/valadovabasemodule.vala
@@ -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);
}
}
diff --git a/codegen/valadovaerrormodule.vala b/codegen/valadovaerrormodule.vala
index 6813ca7..c0df425 100644
--- a/codegen/valadovaerrormodule.vala
+++ b/codegen/valadovaerrormodule.vala
@@ -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);
}
diff --git a/codegen/valadovamethodcallmodule.vala b/codegen/valadovamethodcallmodule.vala
index 5490a61..bb5d470 100644
--- a/codegen/valadovamethodcallmodule.vala
+++ b/codegen/valadovamethodcallmodule.vala
@@ -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);
}
}
diff --git a/codegen/valadovaobjectmodule.vala b/codegen/valadovaobjectmodule.vala
index 6ffc95c..6646897 100644
--- a/codegen/valadovaobjectmodule.vala
+++ b/codegen/valadovaobjectmodule.vala
@@ -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);
}
}
}
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index 0e3ae10..9f78a98 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -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 ());
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 3140339..666ac19 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -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")));
diff --git a/codegen/valagdbusmodule.vala b/codegen/valagdbusmodule.vala
index 2074687..9f13281 100644
--- a/codegen/valagdbusmodule.vala
+++ b/codegen/valagdbusmodule.vala
@@ -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);
}
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index a32100f..7514c1d 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -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);
}
}
diff --git a/codegen/valagerrormodule.vala b/codegen/valagerrormodule.vala
index 4d464ef..7329582 100644
--- a/codegen/valagerrormodule.vala
+++ b/codegen/valagerrormodule.vala
@@ -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);
diff --git a/codegen/valagobjectmodule.vala b/codegen/valagobjectmodule.vala
index 2159941..6431bdf 100644
--- a/codegen/valagobjectmodule.vala
+++ b/codegen/valagobjectmodule.vala
@@ -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);
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index 4de1d4b..fd55878 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -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;
}
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 1095442..aca718d 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -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));
}
}
diff --git a/codegen/valagvariantmodule.vala b/codegen/valagvariantmodule.vala
index 9a5fe30..6e87eb0 100644
--- a/codegen/valagvariantmodule.vala
+++ b/codegen/valagvariantmodule.vala
@@ -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"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]