[vala] Add Variable class
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Add Variable class
- Date: Tue, 27 Jul 2010 16:59:07 +0000 (UTC)
commit 123f70495cedba1bfb3d7e96ee70b9196d95400f
Author: Jürg Billeter <j bitron ch>
Date: Sun Jul 25 21:05:31 2010 +0200
Add Variable class
codegen/valaccodearraymodule.vala | 6 +-
codegen/valaccodebasemodule.vala | 136 +++++++++++++++---------------
codegen/valaccodedelegatemodule.vala | 32 ++++----
codegen/valaccodememberaccessmodule.vala | 4 +-
codegen/valaccodemethodcallmodule.vala | 22 +++---
codegen/valaccodemethodmodule.vala | 20 ++--
codegen/valaccodestructmodule.vala | 20 ++--
codegen/valadbusclientmodule.vala | 92 ++++++++++----------
codegen/valadbusmodule.vala | 6 +-
codegen/valadbusservermodule.vala | 40 +++++-----
codegen/valadovabasemodule.vala | 50 ++++++------
codegen/valadovadelegatemodule.vala | 6 +-
codegen/valadovamemberaccessmodule.vala | 6 +-
codegen/valadovamethodcallmodule.vala | 8 +-
codegen/valadovaobjectmodule.vala | 26 +++---
codegen/valadovastructmodule.vala | 6 +-
codegen/valadovavaluemodule.vala | 14 ++--
codegen/valagasyncmodule.vala | 34 ++++----
codegen/valagdbusclientmodule.vala | 22 +++---
codegen/valagdbusservermodule.vala | 26 +++---
codegen/valagirwriter.vala | 8 +-
codegen/valagsignalmodule.vala | 36 ++++----
codegen/valagtypemodule.vala | 86 ++++++++++----------
codegen/valagvariantmodule.vala | 6 +-
vala/Makefile.am | 1 +
vala/valaarraytype.vala | 4 +-
vala/valaassignment.vala | 6 +-
vala/valaclass.vala | 2 +-
vala/valacodewriter.vala | 22 +++---
vala/valadelegate.vala | 10 +-
vala/valafield.vala | 54 +++---------
vala/valaformalparameter.vala | 79 ++++++------------
vala/valagenieparser.vala | 8 +-
vala/valagirparser.vala | 2 +-
vala/valainitializerlist.vala | 2 +-
vala/valalambdaexpression.vala | 2 +-
vala/valalocalvariable.vala | 37 +--------
vala/valamemberaccess.vala | 6 +-
vala/valamethod.vala | 12 ++--
vala/valamethodcall.vala | 6 +-
vala/valaobjectcreationexpression.vala | 2 +-
vala/valaparser.vala | 14 ++--
vala/valaproperty.vala | 14 ++--
vala/valasemanticanalyzer.vala | 12 ++--
vala/valasignal.vala | 2 +-
vala/valastruct.vala | 6 +-
vala/valavariable.vala | 60 +++++++++++++
vapigen/valagidlparser.vala | 40 +++++-----
48 files changed, 542 insertions(+), 573 deletions(-)
---
diff --git a/codegen/valaccodearraymodule.vala b/codegen/valaccodearraymodule.vala
index f2ad1ed..bec474c 100644
--- a/codegen/valaccodearraymodule.vala
+++ b/codegen/valaccodearraymodule.vala
@@ -1034,12 +1034,12 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
}
public override void generate_parameter (FormalParameter param, CCodeDeclarationSpace decl_space, Map<int,CCodeFormalParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
- if (!(param.parameter_type is ArrayType)) {
+ if (!(param.variable_type is ArrayType)) {
base.generate_parameter (param, decl_space, cparam_map, carg_map);
return;
}
- string ctypename = param.parameter_type.get_cname ();
+ string ctypename = param.variable_type.get_cname ();
if (param.direction != ParameterDirection.IN) {
ctypename += "*";
@@ -1047,7 +1047,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
param.ccodenode = new CCodeFormalParameter (get_variable_cname (param.name), ctypename);
- var array_type = (ArrayType) param.parameter_type;
+ var array_type = (ArrayType) param.variable_type;
generate_type_declaration (array_type.element_type, decl_space);
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 677f4ff..56e9911 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -345,7 +345,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
if (context.module_init_method != null) {
foreach (FormalParameter parameter in context.module_init_method.get_parameters ()) {
- if (parameter.parameter_type.data_type == type_module_type) {
+ if (parameter.variable_type.data_type == type_module_type) {
in_plugin = true;
module_init_param_name = parameter.name;
break;
@@ -822,15 +822,15 @@ public class Vala.CCodeBaseModule : CCodeModule {
return;
}
- generate_type_declaration (f.field_type, decl_space);
+ generate_type_declaration (f.variable_type, decl_space);
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
var cdecl = new CCodeDeclaration (field_ctype);
- cdecl.add_declarator (new CCodeVariableDeclarator (f.get_cname (), null, f.field_type.get_cdeclarator_suffix ()));
+ cdecl.add_declarator (new CCodeVariableDeclarator (f.get_cname (), null, f.variable_type.get_cdeclarator_suffix ()));
if (f.is_private_symbol ()) {
cdecl.modifiers = CCodeModifiers.STATIC;
} else {
@@ -855,8 +855,8 @@ public class Vala.CCodeBaseModule : CCodeModule {
decl_space.add_type_member_declaration (flock);
}
- if (f.field_type is ArrayType && !f.no_array_length) {
- var array_type = (ArrayType) f.field_type;
+ if (f.variable_type is ArrayType && !f.no_array_length) {
+ var array_type = (ArrayType) f.variable_type;
if (!array_type.fixed_length) {
for (int dim = 1; dim <= array_type.rank; dim++) {
@@ -872,8 +872,8 @@ public class Vala.CCodeBaseModule : CCodeModule {
decl_space.add_type_member_declaration (cdecl);
}
}
- } else if (f.field_type is DelegateType) {
- var delegate_type = (DelegateType) f.field_type;
+ } else if (f.variable_type is DelegateType) {
+ var delegate_type = (DelegateType) f.variable_type;
if (delegate_type.delegate_symbol.has_target) {
// create field to store delegate target
@@ -903,7 +903,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
public override void visit_field (Field f) {
visit_member (f);
- check_type (f.field_type);
+ check_type (f.variable_type);
f.accept_children (codegen);
@@ -912,7 +912,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
CCodeExpression lhs = null;
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
@@ -929,9 +929,9 @@ public class Vala.CCodeBaseModule : CCodeModule {
instance_init_fragment.append (new CCodeExpressionStatement (new CCodeAssignment (lhs, rhs)));
- if (f.field_type is ArrayType && !f.no_array_length &&
+ if (f.variable_type is ArrayType && !f.no_array_length &&
f.initializer is ArrayCreationExpression) {
- var array_type = (ArrayType) f.field_type;
+ var array_type = (ArrayType) f.variable_type;
var this_access = new MemberAccess.simple ("this");
this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
this_access.ccodenode = new CCodeIdentifier ("self");
@@ -965,7 +965,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
temp_ref_vars.clear ();
}
- if (requires_destroy (f.field_type) && instance_finalize_fragment != null) {
+ if (requires_destroy (f.variable_type) && instance_finalize_fragment != null) {
var this_access = new MemberAccess.simple ("this");
this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
@@ -978,8 +978,8 @@ public class Vala.CCodeBaseModule : CCodeModule {
var ma = new MemberAccess (this_access, f.name);
ma.symbol_reference = f;
- ma.value_type = f.field_type.copy ();
- instance_finalize_fragment.append (new CCodeExpressionStatement (get_unref_expression (lhs, f.field_type, ma)));
+ ma.value_type = f.variable_type.copy ();
+ instance_finalize_fragment.append (new CCodeExpressionStatement (get_unref_expression (lhs, f.variable_type, ma)));
}
} else if (f.binding == MemberBinding.CLASS) {
if (!is_gtypeinstance) {
@@ -1025,8 +1025,8 @@ public class Vala.CCodeBaseModule : CCodeModule {
lhs = new CCodeIdentifier (f.get_cname ());
- var var_decl = new CCodeVariableDeclarator (f.get_cname (), null, f.field_type.get_cdeclarator_suffix ());
- var_decl.initializer = default_value_for_type (f.field_type, true);
+ var var_decl = new CCodeVariableDeclarator (f.get_cname (), null, f.variable_type.get_cdeclarator_suffix ());
+ var_decl.initializer = default_value_for_type (f.variable_type, true);
if (f.initializer != null) {
var init = (CCodeExpression) f.initializer.ccodenode;
@@ -1045,8 +1045,8 @@ public class Vala.CCodeBaseModule : CCodeModule {
source_declarations.add_type_member_declaration (var_def);
/* add array length fields where necessary */
- if (f.field_type is ArrayType && !f.no_array_length) {
- var array_type = (ArrayType) f.field_type;
+ if (f.variable_type is ArrayType && !f.no_array_length) {
+ var array_type = (ArrayType) f.variable_type;
if (!array_type.fixed_length) {
for (int dim = 1; dim <= array_type.rank; dim++) {
@@ -1071,8 +1071,8 @@ public class Vala.CCodeBaseModule : CCodeModule {
source_declarations.add_type_member_declaration (cdecl);
}
}
- } else if (f.field_type is DelegateType) {
- var delegate_type = (DelegateType) f.field_type;
+ } else if (f.variable_type is DelegateType) {
+ var delegate_type = (DelegateType) f.variable_type;
if (delegate_type.delegate_symbol.has_target) {
// create field to store delegate target
@@ -1107,7 +1107,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
var block = new CCodeBlock ();
var frag = new CCodeFragment ();
- var temp_decl = get_temp_variable (f.field_type);
+ var temp_decl = get_temp_variable (f.variable_type);
var cdecl = new CCodeDeclaration (temp_decl.variable_type.get_cname ());
var vardecl = new CCodeVariableDeclarator (temp_decl.name, rhs);
cdecl.add_declarator (vardecl);
@@ -1123,9 +1123,9 @@ public class Vala.CCodeBaseModule : CCodeModule {
class_init_fragment.append (new CCodeExpressionStatement (new CCodeAssignment (lhs, rhs)));
}
- if (f.field_type is ArrayType && !f.no_array_length &&
+ if (f.variable_type is ArrayType && !f.no_array_length &&
f.initializer is ArrayCreationExpression) {
- var array_type = (ArrayType) f.field_type;
+ var array_type = (ArrayType) f.variable_type;
var ma = new MemberAccess.simple (f.name);
ma.symbol_reference = f;
@@ -1204,7 +1204,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
public override void visit_formal_parameter (FormalParameter p) {
if (!p.ellipsis) {
- check_type (p.parameter_type);
+ check_type (p.variable_type);
}
}
@@ -1630,41 +1630,41 @@ public class Vala.CCodeBaseModule : CCodeModule {
}
void capture_parameter (FormalParameter param, CCodeStruct data, CCodeBlock cblock, int block_id, CCodeBlock free_block) {
- generate_type_declaration (param.parameter_type, source_declarations);
+ generate_type_declaration (param.variable_type, source_declarations);
- var param_type = param.parameter_type.copy ();
+ var param_type = param.variable_type.copy ();
param_type.value_owned = true;
data.add_field (param_type.get_cname (), get_variable_cname (param.name));
- bool is_unowned_delegate = param.parameter_type is DelegateType && !param.parameter_type.value_owned;
+ bool is_unowned_delegate = param.variable_type is DelegateType && !param.variable_type.value_owned;
// create copy if necessary as captured variables may need to be kept alive
CCodeExpression cparam = get_variable_cexpression (param.name);
- if (param.parameter_type.is_real_non_null_struct_type ()) {
+ if (param.variable_type.is_real_non_null_struct_type ()) {
cparam = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, cparam);
}
- if (requires_copy (param_type) && !param.parameter_type.value_owned && !is_unowned_delegate) {
+ if (requires_copy (param_type) && !param.variable_type.value_owned && !is_unowned_delegate) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- ma.value_type = param.parameter_type.copy ();
+ ma.value_type = param.variable_type.copy ();
// directly access parameters in ref expressions
param.captured = false;
- cparam = get_ref_cexpression (param.parameter_type, cparam, ma, param);
+ cparam = get_ref_cexpression (param.variable_type, cparam, ma, param);
param.captured = true;
}
cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_variable_cname (param.name)), cparam)));
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ 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_array_length_cname (get_variable_cname (param.name), dim));
cblock.add_statement (new CCodeExpressionStatement (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)))));
}
- } else if (param.parameter_type is DelegateType) {
+ } else if (param.variable_type is DelegateType) {
data.add_field ("gpointer", get_delegate_target_cname (get_variable_cname (param.name)));
cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_delegate_target_cname (get_variable_cname (param.name))), new CCodeIdentifier (get_delegate_target_cname (get_variable_cname (param.name))))));
- if (param.parameter_type.value_owned) {
+ if (param.variable_type.value_owned) {
data.add_field ("GDestroyNotify", get_delegate_target_destroy_notify_cname (get_variable_cname (param.name)));
cblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (get_variable_cexpression ("_data%d_".printf (block_id)), get_delegate_target_destroy_notify_cname (get_variable_cname (param.name))), new CCodeIdentifier (get_delegate_target_destroy_notify_cname (get_variable_cname (param.name))))));
}
@@ -1680,7 +1680,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
ma.value_type = param_type.copy ();
- free_block.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), get_variable_cname (param.name)), param.parameter_type, ma)));
+ free_block.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), get_variable_cname (param.name)), param.variable_type, ma)));
if (old_coroutine) {
current_method.coroutine = true;
@@ -1900,11 +1900,11 @@ public class Vala.CCodeBaseModule : CCodeModule {
if (b.parent_symbol is Method) {
var m = (Method) b.parent_symbol;
foreach (FormalParameter param in m.get_parameters ()) {
- if (!param.captured && !param.ellipsis && requires_destroy (param.parameter_type) && param.direction == ParameterDirection.IN) {
+ if (!param.captured && !param.ellipsis && requires_destroy (param.variable_type) && param.direction == ParameterDirection.IN) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- ma.value_type = param.parameter_type.copy ();
- cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (param.name), param.parameter_type, ma)));
+ ma.value_type = param.variable_type.copy ();
+ cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (param.name), param.variable_type, ma)));
}
}
}
@@ -2477,17 +2477,17 @@ public class Vala.CCodeBaseModule : CCodeModule {
var s1 = (CCodeExpression) new CCodeMemberAccess.pointer (new CCodeIdentifier ("s1"), f.name); // s1->f
var s2 = (CCodeExpression) new CCodeMemberAccess.pointer (new CCodeIdentifier ("s2"), f.name); // s2->f
- var field_type = f.field_type.copy ();
- make_comparable_cexpression (ref field_type, ref s1, ref field_type, ref s2);
+ var variable_type = f.variable_type.copy ();
+ make_comparable_cexpression (ref variable_type, ref s1, ref variable_type, ref s2);
- if (!(f.field_type is NullType) && f.field_type.compatible (string_type)) {
+ if (!(f.variable_type is NullType) && f.variable_type.compatible (string_type)) {
requires_strcmp0 = true;
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("_vala_strcmp0"));
ccall.add_argument (s1);
ccall.add_argument (s2);
cexp = ccall;
- } else if (f.field_type is StructValueType) {
- var equalfunc = generate_struct_equal_function (f.field_type.data_type as Struct);
+ } else if (f.variable_type is StructValueType) {
+ var equalfunc = generate_struct_equal_function (f.variable_type.data_type as Struct);
var ccall = new CCodeFunctionCall (new CCodeIdentifier (equalfunc));
ccall.add_argument (s1);
ccall.add_argument (s2);
@@ -3256,11 +3256,11 @@ public class Vala.CCodeBaseModule : CCodeModule {
private void append_param_free (Method m, CCodeFragment cfrag) {
foreach (FormalParameter param in m.get_parameters ()) {
- if (!param.ellipsis && requires_destroy (param.parameter_type) && param.direction == ParameterDirection.IN) {
+ if (!param.ellipsis && requires_destroy (param.variable_type) && param.direction == ParameterDirection.IN) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- ma.value_type = param.parameter_type.copy ();
- cfrag.append (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (param.name), param.parameter_type, ma)));
+ ma.value_type = param.variable_type.copy ();
+ cfrag.append (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (param.name), param.variable_type, ma)));
}
}
}
@@ -4204,13 +4204,13 @@ public class Vala.CCodeBaseModule : CCodeModule {
param = params_it.get ();
ellipsis = param.ellipsis;
if (!ellipsis) {
- if (!param.no_array_length && param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (!param.no_array_length && param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
carg_map.set (get_param_pos (param.carray_length_parameter_position + 0.01 * dim), head.get_array_length_cexpression (arg, dim));
}
- } else if (param.parameter_type is DelegateType) {
- var deleg_type = (DelegateType) param.parameter_type;
+ } else if (param.variable_type is DelegateType) {
+ var deleg_type = (DelegateType) param.variable_type;
var d = deleg_type.delegate_symbol;
if (d.has_target) {
CCodeExpression delegate_target_destroy_notify;
@@ -4247,7 +4247,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
break;
}
- if (param.default_expression == null) {
+ if (param.initializer == null) {
Report.error (expr.source_reference, "no default expression for argument %d".printf (i));
return;
}
@@ -4255,9 +4255,9 @@ public class Vala.CCodeBaseModule : CCodeModule {
/* evaluate default expression here as the code
* generator might not have visited the formal
* parameter yet */
- param.default_expression.accept (codegen);
+ param.initializer.accept (codegen);
- carg_map.set (get_param_pos (param.cparameter_position), (CCodeExpression) param.default_expression.ccodenode);
+ carg_map.set (get_param_pos (param.cparameter_position), (CCodeExpression) param.initializer.ccodenode);
i++;
}
@@ -4355,8 +4355,8 @@ public class Vala.CCodeBaseModule : CCodeModule {
}
ccomma.append_expression (new CCodeAssignment (lhs, (CCodeExpression) init.initializer.ccodenode));
- if (f.field_type is ArrayType && !f.no_array_length) {
- var array_type = (ArrayType) f.field_type;
+ if (f.variable_type is ArrayType && !f.no_array_length) {
+ var array_type = (ArrayType) f.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
if (expr.type_reference.data_type is Struct) {
lhs = new CCodeMemberAccess (typed_inst, head.get_array_length_cname (f.get_cname (), dim));
@@ -4366,7 +4366,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
var rhs_array_len = head.get_array_length_cexpression (init.initializer, dim);
ccomma.append_expression (new CCodeAssignment (lhs, rhs_array_len));
}
- } else if (f.field_type is DelegateType && !f.no_delegate_target) {
+ } else if (f.variable_type is DelegateType && !f.no_delegate_target) {
if (expr.type_reference.data_type is Struct) {
lhs = new CCodeMemberAccess (typed_inst, get_delegate_target_cname (f.get_cname ()));
} else {
@@ -4400,9 +4400,9 @@ public class Vala.CCodeBaseModule : CCodeModule {
public CCodeExpression? handle_struct_argument (FormalParameter param, Expression arg, CCodeExpression? cexpr) {
// pass non-simple struct instances always by reference
- if (!(arg.value_type is NullType) && param.parameter_type.data_type is Struct && !((Struct) param.parameter_type.data_type).is_simple_type ()) {
+ if (!(arg.value_type is NullType) && param.variable_type.data_type is Struct && !((Struct) param.variable_type.data_type).is_simple_type ()) {
// we already use a reference for arguments of ref, out, and nullable parameters
- if (param.direction == ParameterDirection.IN && !param.parameter_type.nullable) {
+ if (param.direction == ParameterDirection.IN && !param.variable_type.nullable) {
var unary = cexpr as CCodeUnaryExpression;
if (unary != null && unary.operator == CCodeUnaryOperator.POINTER_INDIRECTION) {
// *expr => expr
@@ -4414,7 +4414,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
// (tmp = expr, &tmp)
var ccomma = new CCodeCommaExpression ();
- var temp_var = get_temp_variable (param.parameter_type, true, null, false);
+ var temp_var = get_temp_variable (param.variable_type, true, null, false);
temp_vars.insert (0, temp_var);
ccomma.append_expression (new CCodeAssignment (get_variable_cexpression (temp_var.name), cexpr));
ccomma.append_expression (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression (temp_var.name)));
@@ -5577,9 +5577,9 @@ public class Vala.CCodeBaseModule : CCodeModule {
public DataType? get_this_type () {
if (current_method != null && current_method.binding == MemberBinding.INSTANCE) {
- return current_method.this_parameter.parameter_type;
+ return current_method.this_parameter.variable_type;
} else if (current_property_accessor != null && current_property_accessor.prop.binding == MemberBinding.INSTANCE) {
- return current_property_accessor.prop.this_parameter.parameter_type;
+ return current_property_accessor.prop.this_parameter.variable_type;
}
return null;
}
@@ -5603,7 +5603,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
var cblock = new CCodeBlock ();
foreach (Field f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
- if (requires_destroy (f.field_type)) {
+ if (requires_destroy (f.variable_type)) {
var lhs = new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), f.get_cname ());
var this_access = new MemberAccess.simple ("this");
@@ -5612,7 +5612,7 @@ public class Vala.CCodeBaseModule : CCodeModule {
var ma = new MemberAccess (this_access, f.name);
ma.symbol_reference = f;
- cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (lhs, f.field_type, ma)));
+ cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (lhs, f.variable_type, ma)));
}
}
}
@@ -5649,17 +5649,17 @@ public class Vala.CCodeBaseModule : CCodeModule {
foreach (Field f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
CCodeExpression copy = new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), f.name);
- if (requires_copy (f.field_type)) {
+ if (requires_copy (f.variable_type)) {
var this_access = new MemberAccess.simple ("this");
this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
this_access.ccodenode = new CCodeIdentifier ("(*self)");
var ma = new MemberAccess (this_access, f.name);
ma.symbol_reference = f;
- copy = get_ref_cexpression (f.field_type, copy, ma, f);
+ copy = get_ref_cexpression (f.variable_type, copy, ma, f);
}
var dest = new CCodeMemberAccess.pointer (new CCodeIdentifier ("dest"), f.name);
- var array_type = f.field_type as ArrayType;
+ var array_type = f.variable_type as ArrayType;
if (array_type != null && array_type.fixed_length) {
// fixed-length (stack-allocated) arrays
source_declarations.add_include ("string.h");
diff --git a/codegen/valaccodedelegatemodule.vala b/codegen/valaccodedelegatemodule.vala
index 3b21bba..706d8bf 100644
--- a/codegen/valaccodedelegatemodule.vala
+++ b/codegen/valaccodedelegatemodule.vala
@@ -57,8 +57,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
cfundecl.add_parameter ((CCodeFormalParameter) param.ccodenode);
// handle array parameters
- if (!param.no_array_length && param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (!param.no_array_length && param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
var length_ctype = "int";
if (param.direction != ParameterDirection.IN) {
@@ -71,8 +71,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
}
}
// handle delegate parameters
- if (param.parameter_type is DelegateType) {
- var deleg_type = (DelegateType) param.parameter_type;
+ if (param.variable_type is DelegateType) {
+ var deleg_type = (DelegateType) param.variable_type;
var param_d = deleg_type.delegate_symbol;
if (param_d.has_target) {
var cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), "void*");
@@ -398,8 +398,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
var d_params = d.get_parameters ();
foreach (FormalParameter param in d_params) {
if (dynamic_sig != null
- && param.parameter_type is ArrayType
- && ((ArrayType) param.parameter_type).element_type.data_type == string_type.data_type) {
+ && param.variable_type is ArrayType
+ && ((ArrayType) param.variable_type).element_type.data_type == string_type.data_type) {
// use null-terminated string arrays for dynamic signals for compatibility reasons
param.no_array_length = true;
param.array_null_terminated = true;
@@ -489,8 +489,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
carg_map.set (get_param_pos (param.cparameter_position), arg);
// handle array arguments
- if (!param.no_array_length && param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (!param.no_array_length && param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
CCodeExpression clength;
if (d_params.get (i).array_null_terminated) {
@@ -505,8 +505,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
}
carg_map.set (get_param_pos (param.carray_length_parameter_position + 0.01 * dim), clength);
}
- } else if (param.parameter_type is DelegateType) {
- var deleg_type = (DelegateType) param.parameter_type;
+ } else if (param.variable_type is DelegateType) {
+ var deleg_type = (DelegateType) param.variable_type;
if (deleg_type.delegate_symbol.has_target) {
var ctarget = new CCodeIdentifier (get_delegate_target_cname (d_params.get (i).name));
@@ -613,17 +613,17 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
}
public override void generate_parameter (FormalParameter param, CCodeDeclarationSpace decl_space, Map<int,CCodeFormalParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
- if (!(param.parameter_type is DelegateType || param.parameter_type is MethodType)) {
+ if (!(param.variable_type is DelegateType || param.variable_type is MethodType)) {
base.generate_parameter (param, decl_space, cparam_map, carg_map);
return;
}
- string ctypename = param.parameter_type.get_cname ();
+ string ctypename = param.variable_type.get_cname ();
string target_ctypename = "void*";
string target_destroy_notify_ctypename = "GDestroyNotify";
if (param.parent_symbol is Delegate
- && param.parameter_type.get_cname () == ((Delegate) param.parent_symbol).get_cname ()) {
+ && param.variable_type.get_cname () == ((Delegate) param.parent_symbol).get_cname ()) {
// recursive delegate
ctypename = "GCallback";
}
@@ -641,8 +641,8 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
carg_map.set (get_param_pos (param.cparameter_position), get_variable_cexpression (param.name));
}
- if (param.parameter_type is DelegateType) {
- var deleg_type = (DelegateType) param.parameter_type;
+ if (param.variable_type is DelegateType) {
+ var deleg_type = (DelegateType) param.variable_type;
var d = deleg_type.delegate_symbol;
generate_delegate_declaration (d, decl_space);
@@ -661,7 +661,7 @@ public class Vala.CCodeDelegateModule : CCodeArrayModule {
}
}
}
- } else if (param.parameter_type is MethodType) {
+ } else if (param.variable_type is MethodType) {
var cparam = new CCodeFormalParameter (get_delegate_target_cname (get_variable_cname (param.name)), target_ctypename);
cparam_map.set (get_param_pos (param.cdelegate_target_parameter_position), cparam);
if (carg_map != null) {
diff --git a/codegen/valaccodememberaccessmodule.vala b/codegen/valaccodememberaccessmodule.vala
index 57ddcd3..52ea34d 100644
--- a/codegen/valaccodememberaccessmodule.vala
+++ b/codegen/valaccodememberaccessmodule.vala
@@ -395,9 +395,9 @@ public class Vala.CCodeMemberAccessModule : CCodeControlFlowModule {
// use closure
expr.ccodenode = get_variable_cexpression (p.name);
} else {
- var type_as_struct = p.parameter_type.data_type as Struct;
+ var type_as_struct = p.variable_type.data_type as Struct;
if (p.direction != ParameterDirection.IN
- || (type_as_struct != null && !type_as_struct.is_simple_type () && !p.parameter_type.nullable)) {
+ || (type_as_struct != null && !type_as_struct.is_simple_type () && !p.variable_type.nullable)) {
expr.ccodenode = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (get_variable_cname (p.name)));
} else {
// Property setters of non simple structs shall replace all occurences
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 85816ee..2f2306b 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -347,8 +347,8 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
carg_map = out_arg_map;
}
- if (!param.no_array_length && param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (!param.no_array_length && param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
CCodeExpression? array_length_expr = null;
if (param.array_length_type != null) {
@@ -381,8 +381,8 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
carg_map.set (get_param_pos (param.carray_length_parameter_position + 0.01 * dim), array_length_expr);
}
multiple_cargs = true;
- } else if (param.parameter_type is DelegateType) {
- var deleg_type = (DelegateType) param.parameter_type;
+ } else if (param.variable_type is DelegateType) {
+ var deleg_type = (DelegateType) param.variable_type;
var d = deleg_type.delegate_symbol;
if (d.has_target) {
CCodeExpression delegate_target_destroy_notify;
@@ -402,14 +402,14 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
multiple_cargs = true;
}
}
- } else if (param.parameter_type is MethodType) {
+ } else if (param.variable_type is MethodType) {
// callbacks in dynamic method calls
CCodeExpression delegate_target_destroy_notify;
carg_map.set (get_param_pos (param.cdelegate_target_parameter_position), get_delegate_target_cexpression (arg, out delegate_target_destroy_notify));
multiple_cargs = true;
- } else if (param.parameter_type is GenericType) {
+ } else if (param.variable_type is GenericType) {
if (m != null && m.simple_generics) {
- var generic_type = (GenericType) param.parameter_type;
+ var generic_type = (GenericType) param.variable_type;
int type_param_index = m.get_type_parameter_index (generic_type.type_parameter.name);
var type_arg = ma.get_type_arguments ().get (type_param_index);
if (requires_copy (type_arg)) {
@@ -445,13 +445,13 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
// disabled for arrays for now as that requires special handling
// (ret_tmp = call (&tmp), var1 = (assign_tmp = dup (tmp), free (var1), assign_tmp), ret_tmp)
if (param.direction != ParameterDirection.IN && requires_destroy (arg.value_type)
- && (param.direction == ParameterDirection.OUT || !param.parameter_type.value_owned)
- && !(param.parameter_type is ArrayType) && !(param.parameter_type is DelegateType)) {
+ && (param.direction == ParameterDirection.OUT || !param.variable_type.value_owned)
+ && !(param.variable_type is ArrayType) && !(param.variable_type is DelegateType)) {
var unary = (UnaryExpression) arg;
var ccomma = new CCodeCommaExpression ();
- var temp_var = get_temp_variable (param.parameter_type, param.parameter_type.value_owned);
+ var temp_var = get_temp_variable (param.variable_type, param.variable_type.value_owned);
temp_vars.insert (0, temp_var);
cexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression (temp_var.name));
@@ -478,7 +478,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
var assign_temp_var = get_temp_variable (unary.inner.value_type, unary.inner.value_type.value_owned, null, false);
temp_vars.insert (0, assign_temp_var);
- cassign_comma.append_expression (new CCodeAssignment (get_variable_cexpression (assign_temp_var.name), transform_expression (get_variable_cexpression (temp_var.name), param.parameter_type, unary.inner.value_type, arg)));
+ cassign_comma.append_expression (new CCodeAssignment (get_variable_cexpression (assign_temp_var.name), transform_expression (get_variable_cexpression (temp_var.name), param.variable_type, unary.inner.value_type, arg)));
// unref old value
cassign_comma.append_expression (get_unref_expression ((CCodeExpression) unary.inner.ccodenode, arg.value_type, arg));
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index aa786a5..a07ac05 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -544,17 +544,17 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
}
if (param.direction != ParameterDirection.OUT) {
- var t = param.parameter_type.data_type;
+ var t = param.variable_type.data_type;
if (t != null && t.is_reference_type ()) {
- var type_check = create_method_type_check_statement (m, creturn_type, t, !param.parameter_type.nullable, get_variable_cname (param.name));
+ var type_check = create_method_type_check_statement (m, creturn_type, t, !param.variable_type.nullable, get_variable_cname (param.name));
if (type_check != null) {
type_check.line = function.line;
cinit.append (type_check);
}
}
} else if (!m.coroutine) {
- var t = param.parameter_type.data_type;
- if ((t != null && t.is_reference_type ()) || param.parameter_type is ArrayType) {
+ var t = param.variable_type.data_type;
+ if ((t != null && t.is_reference_type ()) || param.variable_type is ArrayType) {
// ensure that the passed reference for output parameter is cleared
var a = new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (param.name)), new CCodeConstant ("NULL"));
var cblock = new CCodeBlock ();
@@ -815,19 +815,19 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
public virtual void generate_parameter (FormalParameter param, CCodeDeclarationSpace decl_space, Map<int,CCodeFormalParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
if (!param.ellipsis) {
- string ctypename = param.parameter_type.get_cname ();
+ string ctypename = param.variable_type.get_cname ();
- generate_type_declaration (param.parameter_type, decl_space);
+ generate_type_declaration (param.variable_type, decl_space);
// pass non-simple structs always by reference
- if (param.parameter_type.data_type is Struct) {
- var st = (Struct) param.parameter_type.data_type;
+ if (param.variable_type.data_type is Struct) {
+ var st = (Struct) param.variable_type.data_type;
if (!st.is_simple_type () && param.direction == ParameterDirection.IN) {
- if (st.is_immutable && !param.parameter_type.value_owned) {
+ if (st.is_immutable && !param.variable_type.value_owned) {
ctypename = "const " + ctypename;
}
- if (!param.parameter_type.nullable) {
+ if (!param.variable_type.nullable) {
ctypename += "*";
}
}
diff --git a/codegen/valaccodestructmodule.vala b/codegen/valaccodestructmodule.vala
index 4b3587a..16aaf14 100644
--- a/codegen/valaccodestructmodule.vala
+++ b/codegen/valaccodestructmodule.vala
@@ -66,18 +66,18 @@ public class Vala.CCodeStructModule : CCodeBaseModule {
instance_struct.deprecated = st.deprecated;
foreach (Field f in st.get_fields ()) {
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
if (f.binding == MemberBinding.INSTANCE) {
- generate_type_declaration (f.field_type, decl_space);
+ generate_type_declaration (f.variable_type, decl_space);
- instance_struct.add_field (field_ctype, f.get_cname () + f.field_type.get_cdeclarator_suffix (), f.deprecated ? " G_GNUC_DEPRECATED" : null);
- if (f.field_type is ArrayType && !f.no_array_length) {
+ instance_struct.add_field (field_ctype, f.get_cname () + f.variable_type.get_cdeclarator_suffix (), f.deprecated ? " G_GNUC_DEPRECATED" : null);
+ if (f.variable_type is ArrayType && !f.no_array_length) {
// create fields to store array dimensions
- var array_type = (ArrayType) f.field_type;
+ var array_type = (ArrayType) f.variable_type;
if (!array_type.fixed_length) {
var len_type = int_type.copy ();
@@ -90,8 +90,8 @@ public class Vala.CCodeStructModule : CCodeBaseModule {
instance_struct.add_field (len_type.get_cname (), head.get_array_size_cname (f.name));
}
}
- } else if (f.field_type is DelegateType) {
- var delegate_type = (DelegateType) f.field_type;
+ } else if (f.variable_type is DelegateType) {
+ var delegate_type = (DelegateType) f.variable_type;
if (delegate_type.delegate_symbol.has_target) {
// create field to store delegate target
instance_struct.add_field ("gpointer", get_delegate_target_cname (f.name));
@@ -259,17 +259,17 @@ public class Vala.CCodeStructModule : CCodeBaseModule {
foreach (var f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
CCodeExpression copy = new CCodeMemberAccess.pointer (new CCodeIdentifier ("self"), f.name);
- if (requires_copy (f.field_type)) {
+ if (requires_copy (f.variable_type)) {
var this_access = new MemberAccess.simple ("this");
this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
this_access.ccodenode = new CCodeIdentifier ("(*self)");
var ma = new MemberAccess (this_access, f.name);
ma.symbol_reference = f;
- copy = get_ref_cexpression (f.field_type, copy, ma, f);
+ copy = get_ref_cexpression (f.variable_type, copy, ma, f);
}
var dest = new CCodeMemberAccess.pointer (new CCodeIdentifier ("dest"), f.name);
- var array_type = f.field_type as ArrayType;
+ var array_type = f.variable_type as ArrayType;
if (array_type != null && array_type.fixed_length) {
// fixed-length (stack-allocated) arrays
source_declarations.add_include ("string.h");
diff --git a/codegen/valadbusclientmodule.vala b/codegen/valadbusclientmodule.vala
index 9e02444..cb9ff5d 100644
--- a/codegen/valadbusclientmodule.vala
+++ b/codegen/valadbusclientmodule.vala
@@ -173,15 +173,15 @@ public class Vala.DBusClientModule : DBusModule {
int i = 0;
foreach (FormalParameter param in reply_method.get_parameters ()) {
if ((++i) == param_count) {
- if (!(param.parameter_type is ErrorType)) {
+ if (!(param.variable_type is ErrorType)) {
Report.error (null, "DBus reply callbacks must end with GLib.Error argument");
return;
}
break;
}
- if (param.parameter_type is ArrayType && ((ArrayType) param.parameter_type).element_type.data_type != string_type.data_type) {
- var array_type = (ArrayType) param.parameter_type;
+ if (param.variable_type is ArrayType && ((ArrayType) param.variable_type).element_type.data_type != string_type.data_type) {
+ var array_type = (ArrayType) param.variable_type;
CCodeDeclaration cdecl;
if (dbus_use_ptr_array (array_type)) {
cdecl = new CCodeDeclaration ("GPtrArray*");
@@ -195,14 +195,14 @@ public class Vala.DBusClientModule : DBusModule {
creply_call.add_argument (new CCodeCastExpression (new CCodeMemberAccess.pointer (new CCodeIdentifier (param.name), dbus_use_ptr_array (array_type) ? "pdata" : "data"), array_type.get_cname ()));
creply_call.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier (param.name), "len"));
} else {
- var cdecl = new CCodeDeclaration (param.parameter_type.get_cname ());
+ var cdecl = new CCodeDeclaration (param.variable_type.get_cname ());
cdecl.add_declarator (new CCodeVariableDeclarator (param.name));
cb_fun.block.add_statement (cdecl);
- cend_call.add_argument (get_dbus_g_type (param.parameter_type));
+ cend_call.add_argument (get_dbus_g_type (param.variable_type));
cend_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
creply_call.add_argument (new CCodeIdentifier (param.name));
- if (param.parameter_type is ArrayType && ((ArrayType) param.parameter_type).element_type.data_type == string_type.data_type) {
+ if (param.variable_type is ArrayType && ((ArrayType) param.variable_type).element_type.data_type == string_type.data_type) {
var cstrvlen = new CCodeFunctionCall (new CCodeIdentifier ("g_strv_length"));
cstrvlen.add_argument (new CCodeIdentifier (param.name));
creply_call.add_argument (cstrvlen);
@@ -244,8 +244,8 @@ public class Vala.DBusClientModule : DBusModule {
}
foreach (FormalParameter param in method.get_parameters ()) {
- if (param.parameter_type is MethodType
- || param.parameter_type is DelegateType) {
+ if (param.variable_type is MethodType
+ || param.variable_type is DelegateType) {
// callback parameter
break;
}
@@ -254,7 +254,7 @@ public class Vala.DBusClientModule : DBusModule {
continue;
}
- var array_type = param.parameter_type as ArrayType;
+ var array_type = param.variable_type as ArrayType;
if (array_type != null) {
// array parameter
if (array_type.element_type.data_type != string_type.data_type) {
@@ -308,9 +308,9 @@ public class Vala.DBusClientModule : DBusModule {
ccall.add_argument (new CCodeIdentifier ("G_TYPE_STRV"));
ccall.add_argument (new CCodeIdentifier (param.name));
}
- } else if (get_type_signature (param.parameter_type).has_prefix ("(")) {
+ } else if (get_type_signature (param.variable_type).has_prefix ("(")) {
// struct parameter
- var st = (Struct) param.parameter_type.data_type;
+ var st = (Struct) param.variable_type.data_type;
var array_construct = new CCodeFunctionCall (new CCodeIdentifier ("g_value_array_new"));
array_construct.add_argument (new CCodeConstant ("0"));
@@ -338,10 +338,10 @@ public class Vala.DBusClientModule : DBusModule {
var cinit_call = new CCodeFunctionCall (new CCodeIdentifier ("g_value_init"));
cinit_call.add_argument (val_ptr);
- cinit_call.add_argument (new CCodeIdentifier (f.field_type.data_type.get_type_id ()));
+ cinit_call.add_argument (new CCodeIdentifier (f.variable_type.data_type.get_type_id ()));
block.add_statement (new CCodeExpressionStatement (cinit_call));
- var cset_call = new CCodeFunctionCall (new CCodeIdentifier (f.field_type.data_type.get_set_value_function ()));
+ var cset_call = new CCodeFunctionCall (new CCodeIdentifier (f.variable_type.data_type.get_set_value_function ()));
cset_call.add_argument (val_ptr);
cset_call.add_argument (new CCodeMemberAccess.pointer (new CCodeIdentifier (param.name), f.name));
block.add_statement (new CCodeExpressionStatement (cset_call));
@@ -352,10 +352,10 @@ public class Vala.DBusClientModule : DBusModule {
block.add_statement (new CCodeExpressionStatement (cappend_call));
}
- ccall.add_argument (get_dbus_g_type (param.parameter_type));
+ ccall.add_argument (get_dbus_g_type (param.variable_type));
ccall.add_argument (new CCodeIdentifier ("dbus_%s".printf (param.name)));
} else {
- ccall.add_argument (get_dbus_g_type (param.parameter_type));
+ ccall.add_argument (get_dbus_g_type (param.variable_type));
ccall.add_argument (new CCodeIdentifier (param.name));
}
}
@@ -365,7 +365,7 @@ public class Vala.DBusClientModule : DBusModule {
var out_marshalling_fragment = new CCodeFragment ();
foreach (FormalParameter param in method.get_parameters ()) {
- if (param.parameter_type is MethodType) {
+ if (param.variable_type is MethodType) {
// callback parameter
break;
}
@@ -374,9 +374,9 @@ public class Vala.DBusClientModule : DBusModule {
continue;
}
- if (get_type_signature (param.parameter_type).has_prefix ("(")) {
+ if (get_type_signature (param.variable_type).has_prefix ("(")) {
// struct output parameter
- var st = (Struct) param.parameter_type.data_type;
+ var st = (Struct) param.variable_type.data_type;
var cdecl = new CCodeDeclaration ("GValueArray*");
cdecl.add_declarator (new CCodeVariableDeclarator ("dbus_%s".printf (param.name)));
@@ -388,13 +388,13 @@ public class Vala.DBusClientModule : DBusModule {
continue;
}
- var cget_call = new CCodeFunctionCall (new CCodeIdentifier (f.field_type.data_type.get_get_value_function ()));
+ var cget_call = new CCodeFunctionCall (new CCodeIdentifier (f.variable_type.data_type.get_get_value_function ()));
cget_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeElementAccess (new CCodeMemberAccess.pointer (new CCodeIdentifier ("dbus_%s".printf (param.name)), "values"), new CCodeConstant (i.to_string ()))));
var converted_value = cget_call;
- if (requires_copy (f.field_type)) {
- var dupexpr = get_dup_func_expression (f.field_type, expr.source_reference);
+ if (requires_copy (f.variable_type)) {
+ var dupexpr = get_dup_func_expression (f.variable_type, expr.source_reference);
converted_value = new CCodeFunctionCall (dupexpr);
converted_value.add_argument (cget_call);
}
@@ -405,10 +405,10 @@ public class Vala.DBusClientModule : DBusModule {
i++;
}
- ccall.add_argument (get_dbus_g_type (param.parameter_type));
+ ccall.add_argument (get_dbus_g_type (param.variable_type));
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier ("dbus_%s".printf (param.name))));
} else {
- ccall.add_argument (get_dbus_g_type (param.parameter_type));
+ ccall.add_argument (get_dbus_g_type (param.variable_type));
ccall.add_argument (new CCodeIdentifier (param.name));
}
}
@@ -470,13 +470,13 @@ public class Vala.DBusClientModule : DBusModule {
continue;
}
- var cget_call = new CCodeFunctionCall (new CCodeIdentifier (f.field_type.data_type.get_get_value_function ()));
+ var cget_call = new CCodeFunctionCall (new CCodeIdentifier (f.variable_type.data_type.get_get_value_function ()));
cget_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeElementAccess (new CCodeMemberAccess.pointer (new CCodeIdentifier ("dbus_result"), "values"), new CCodeConstant (i.to_string ()))));
var converted_value = cget_call;
- if (requires_copy (f.field_type)) {
- var dupexpr = get_dup_func_expression (f.field_type, expr.source_reference);
+ if (requires_copy (f.variable_type)) {
+ var dupexpr = get_dup_func_expression (f.variable_type, expr.source_reference);
converted_value = new CCodeFunctionCall (dupexpr);
converted_value.add_argument (cget_call);
}
@@ -594,7 +594,7 @@ public class Vala.DBusClientModule : DBusModule {
continue;
}
- type_call.add_argument (get_dbus_g_type (f.field_type));
+ type_call.add_argument (get_dbus_g_type (f.variable_type));
}
type_call.add_argument (new CCodeConstant ("G_TYPE_INVALID"));
@@ -877,8 +877,8 @@ public class Vala.DBusClientModule : DBusModule {
continue;
}
- register_call.add_argument (get_dbus_g_type (param.parameter_type));
- add_call.add_argument (get_dbus_g_type (param.parameter_type));
+ register_call.add_argument (get_dbus_g_type (param.variable_type));
+ add_call.add_argument (get_dbus_g_type (param.variable_type));
}
register_call.add_argument (new CCodeIdentifier ("G_TYPE_INVALID"));
add_call.add_argument (new CCodeIdentifier ("G_TYPE_INVALID"));
@@ -1540,27 +1540,27 @@ public class Vala.DBusClientModule : DBusModule {
string type_signature = "";
foreach (FormalParameter param in sig.get_parameters ()) {
- var owned_type = param.parameter_type.copy ();
+ var owned_type = param.variable_type.copy ();
owned_type.value_owned = true;
cdecl = new CCodeDeclaration (owned_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.zero (param.name, default_value_for_type (param.parameter_type, true)));
+ cdecl.add_declarator (new CCodeVariableDeclarator.zero (param.name, default_value_for_type (param.variable_type, true)));
prefragment.append (cdecl);
- if (get_type_signature (param.parameter_type) == null) {
- Report.error (param.parameter_type.source_reference, "D-Bus serialization of type `%s' is not supported".printf (param.parameter_type.to_string ()));
+ if (get_type_signature (param.variable_type) == null) {
+ Report.error (param.variable_type.source_reference, "D-Bus serialization of type `%s' is not supported".printf (param.variable_type.to_string ()));
continue;
}
- var st = param.parameter_type.data_type as Struct;
+ var st = param.variable_type.data_type as Struct;
if (st != null && !st.is_simple_type ()) {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
} else {
ccall.add_argument (new CCodeIdentifier (param.name));
}
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
string length_cname = get_array_length_cname (param.name, dim);
@@ -1572,10 +1572,10 @@ public class Vala.DBusClientModule : DBusModule {
}
}
- type_signature += get_type_signature (param.parameter_type);
+ type_signature += get_type_signature (param.variable_type);
var target = new CCodeIdentifier (param.name);
- var expr = read_expression (prefragment, param.parameter_type, new CCodeIdentifier ("iter"), target);
+ var expr = read_expression (prefragment, param.variable_type, new CCodeIdentifier ("iter"), target);
prefragment.append (new CCodeExpressionStatement (new CCodeAssignment (target, expr)));
if (requires_destroy (owned_type)) {
@@ -1682,26 +1682,26 @@ public class Vala.DBusClientModule : DBusModule {
foreach (FormalParameter param in m.get_parameters ()) {
if (param.direction == ParameterDirection.IN) {
- if (param.parameter_type.data_type != null
- && param.parameter_type.data_type.get_full_name () == "DBus.BusName") {
+ if (param.variable_type.data_type != null
+ && param.variable_type.data_type.get_full_name () == "DBus.BusName") {
// ignore BusName sender parameters
continue;
}
CCodeExpression expr = new CCodeIdentifier (param.name);
- if (param.parameter_type.is_real_struct_type ()) {
+ if (param.variable_type.is_real_struct_type ()) {
expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, expr);
}
- write_expression (prefragment, param.parameter_type, new CCodeIdentifier ("_iter"), expr);
+ write_expression (prefragment, param.variable_type, new CCodeIdentifier ("_iter"), expr);
} else {
if (no_reply) {
Report.error (param.source_reference, "No-reply DBus methods must not have out parameters");
break;
}
- cdecl = new CCodeDeclaration (param.parameter_type.get_cname ());
+ cdecl = new CCodeDeclaration (param.variable_type.get_cname ());
cdecl.add_declarator (new CCodeVariableDeclarator ("_" + param.name));
postfragment.append (cdecl);
- var array_type = param.parameter_type as ArrayType;
+ var array_type = param.variable_type as ArrayType;
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
@@ -1712,7 +1712,7 @@ public class Vala.DBusClientModule : DBusModule {
}
var target = new CCodeIdentifier ("_" + param.name);
- var expr = read_expression (postfragment, param.parameter_type, new CCodeIdentifier ("_iter"), target);
+ var expr = read_expression (postfragment, param.variable_type, new CCodeIdentifier ("_iter"), target);
postfragment.append (new CCodeExpressionStatement (new CCodeAssignment (target, expr)));
// TODO check that parameter is not NULL (out parameters are optional)
@@ -2266,7 +2266,7 @@ public class Vala.DBusClientModule : DBusModule {
foreach (FormalParameter param in m.get_parameters ()) {
if (param.direction == ParameterDirection.OUT) {
- type_signature += get_type_signature (param.parameter_type);
+ type_signature += get_type_signature (param.variable_type);
}
}
diff --git a/codegen/valadbusmodule.vala b/codegen/valadbusmodule.vala
index 1ee94d4..65ce9b0 100644
--- a/codegen/valadbusmodule.vala
+++ b/codegen/valadbusmodule.vala
@@ -126,7 +126,7 @@ public class Vala.DBusModule : GAsyncModule {
str.append_c ('(');
foreach (Field f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
- str.append (get_type_signature (f.field_type));
+ str.append (get_type_signature (f.variable_type));
}
}
str.append_c (')');
@@ -418,7 +418,7 @@ public class Vala.DBusModule : GAsyncModule {
continue;
}
- var field_expr = read_expression (fragment, f.field_type, new CCodeIdentifier (subiter_name), new CCodeMemberAccess (new CCodeIdentifier (temp_name), f.get_cname ()));
+ var field_expr = read_expression (fragment, f.variable_type, new CCodeIdentifier (subiter_name), new CCodeMemberAccess (new CCodeIdentifier (temp_name), f.get_cname ()));
fragment.append (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess (new CCodeIdentifier (temp_name), f.get_cname ()), field_expr)));
}
@@ -783,7 +783,7 @@ public class Vala.DBusModule : GAsyncModule {
continue;
}
- write_expression (fragment, f.field_type, new CCodeIdentifier (subiter_name), new CCodeMemberAccess (struct_expr, f.get_cname ()));
+ write_expression (fragment, f.variable_type, new CCodeIdentifier (subiter_name), new CCodeMemberAccess (struct_expr, f.get_cname ()));
}
iter_call = new CCodeFunctionCall (new CCodeIdentifier ("dbus_message_iter_close_container"));
diff --git a/codegen/valadbusservermodule.vala b/codegen/valadbusservermodule.vala
index 399a1cc..54f6474 100644
--- a/codegen/valadbusservermodule.vala
+++ b/codegen/valadbusservermodule.vala
@@ -181,11 +181,11 @@ public class Vala.DBusServerModule : DBusClientModule {
string type_signature = "";
foreach (FormalParameter param in m.get_parameters ()) {
- var owned_type = param.parameter_type.copy ();
+ var owned_type = param.variable_type.copy ();
owned_type.value_owned = true;
cdecl = new CCodeDeclaration (owned_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.zero (param.name, default_value_for_type (param.parameter_type, true)));
+ cdecl.add_declarator (new CCodeVariableDeclarator.zero (param.name, default_value_for_type (param.variable_type, true)));
if (param.direction == ParameterDirection.IN) {
in_prefragment.append (cdecl);
} else {
@@ -193,8 +193,8 @@ public class Vala.DBusServerModule : DBusClientModule {
}
if (type_signature == ""
&& param.direction == ParameterDirection.IN
- && param.parameter_type.data_type != null
- && param.parameter_type.data_type.get_full_name () == "DBus.BusName") {
+ && param.variable_type.data_type != null
+ && param.variable_type.data_type.get_full_name () == "DBus.BusName") {
// first parameter is a string parameter called 'sender'
// pass bus name of sender
var get_sender = new CCodeFunctionCall (new CCodeIdentifier ("dbus_message_get_sender"));
@@ -203,13 +203,13 @@ public class Vala.DBusServerModule : DBusClientModule {
continue;
}
- if (get_type_signature (param.parameter_type) == null) {
- Report.error (param.parameter_type.source_reference, "D-Bus serialization of type `%s' is not supported".printf (param.parameter_type.to_string ()));
+ if (get_type_signature (param.variable_type) == null) {
+ Report.error (param.variable_type.source_reference, "D-Bus serialization of type `%s' is not supported".printf (param.variable_type.to_string ()));
continue;
}
if (!m.coroutine || param.direction == ParameterDirection.IN) {
- var st = param.parameter_type.data_type as Struct;
+ var st = param.variable_type.data_type as Struct;
if (param.direction != ParameterDirection.IN
|| (st != null && !st.is_simple_type ())) {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
@@ -220,8 +220,8 @@ public class Vala.DBusServerModule : DBusClientModule {
finish_ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
}
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
string length_cname = get_array_length_cname (param.name, dim);
@@ -244,13 +244,13 @@ public class Vala.DBusServerModule : DBusClientModule {
}
if (param.direction == ParameterDirection.IN) {
- type_signature += get_type_signature (param.parameter_type);
+ type_signature += get_type_signature (param.variable_type);
var target = new CCodeIdentifier (param.name);
- var expr = read_expression (in_prefragment, param.parameter_type, new CCodeIdentifier ("iter"), target);
+ var expr = read_expression (in_prefragment, param.variable_type, new CCodeIdentifier ("iter"), target);
in_prefragment.append (new CCodeExpressionStatement (new CCodeAssignment (target, expr)));
} else {
- write_expression (out_postfragment, param.parameter_type, new CCodeIdentifier ("iter"), new CCodeIdentifier (param.name));
+ write_expression (out_postfragment, param.variable_type, new CCodeIdentifier ("iter"), new CCodeIdentifier (param.name));
}
if (requires_destroy (owned_type)) {
@@ -496,8 +496,8 @@ public class Vala.DBusServerModule : DBusClientModule {
generate_parameter (param, source_declarations, new HashMap<int,CCodeFormalParameter> (), null);
function.add_parameter ((CCodeFormalParameter) get_ccodenode (param));
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
function.add_parameter (new CCodeFormalParameter (head.get_array_length_cname (param.name, dim), "int"));
}
@@ -540,10 +540,10 @@ public class Vala.DBusServerModule : DBusClientModule {
foreach (FormalParameter param in sig.get_parameters ()) {
CCodeExpression expr = new CCodeIdentifier (param.name);
- if (param.parameter_type.is_real_struct_type ()) {
+ if (param.variable_type.is_real_struct_type ()) {
expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, expr);
}
- write_expression (prefragment, param.parameter_type, new CCodeIdentifier ("_iter"), expr);
+ write_expression (prefragment, param.variable_type, new CCodeIdentifier ("_iter"), expr);
}
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("dbus_connection_send"));
@@ -1295,15 +1295,15 @@ public class Vala.DBusServerModule : DBusClientModule {
result += " <method name=\"%s\">\n".printf (get_dbus_name_for_member (m));
foreach (var param in m.get_parameters ()) {
- if (param.parameter_type.data_type != null
- && param.parameter_type.data_type.get_full_name () == "DBus.BusName") {
+ if (param.variable_type.data_type != null
+ && param.variable_type.data_type.get_full_name () == "DBus.BusName") {
// skip sender parameter
// (implicit in D-Bus)
continue;
}
string direction = param.direction == ParameterDirection.IN ? "in" : "out";
- result += " <arg name=\"%s\" type=\"%s\" direction=\"%s\"/>\n".printf (param.name, get_type_signature (param.parameter_type), direction);
+ result += " <arg name=\"%s\" type=\"%s\" direction=\"%s\"/>\n".printf (param.name, get_type_signature (param.variable_type), direction);
}
if (!(m.return_type is VoidType)) {
result += " <arg name=\"%s\" type=\"%s\" direction=\"out\"/>\n".printf (dbus_result_name (m), get_type_signature (m.return_type));
@@ -1336,7 +1336,7 @@ public class Vala.DBusServerModule : DBusClientModule {
result += " <signal name=\"%s\">\n".printf (get_dbus_name_for_member (sig));
foreach (var param in sig.get_parameters ()) {
- result += " <arg name=\"%s\" type=\"%s\"/>\n".printf (param.name, get_type_signature (param.parameter_type));
+ result += " <arg name=\"%s\" type=\"%s\"/>\n".printf (param.name, get_type_signature (param.variable_type));
}
result += " </signal>\n";
diff --git a/codegen/valadovabasemodule.vala b/codegen/valadovabasemodule.vala
index 915448f..14d0ee1 100644
--- a/codegen/valadovabasemodule.vala
+++ b/codegen/valadovabasemodule.vala
@@ -431,9 +431,9 @@ internal class Vala.DovaBaseModule : CCodeModule {
return;
}
- generate_type_declaration (f.field_type, decl_space);
+ generate_type_declaration (f.variable_type, decl_space);
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
@@ -460,7 +460,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
CCodeExpression lhs = null;
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
@@ -483,7 +483,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
temp_vars.clear ();
}
- if (requires_destroy (f.field_type) && instance_finalize_fragment != null) {
+ if (requires_destroy (f.variable_type) && instance_finalize_fragment != null) {
var this_access = new MemberAccess.simple ("this");
this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
@@ -496,7 +496,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
var ma = new MemberAccess (this_access, f.name);
ma.symbol_reference = f;
- instance_finalize_fragment.append (new CCodeExpressionStatement (get_unref_expression (lhs, f.field_type, ma)));
+ instance_finalize_fragment.append (new CCodeExpressionStatement (get_unref_expression (lhs, f.variable_type, ma)));
}
} else {
generate_field_declaration (f, source_declarations);
@@ -508,7 +508,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
lhs = new CCodeIdentifier (f.get_cname ());
var var_decl = new CCodeVariableDeclarator (f.get_cname ());
- var_decl.initializer = default_value_for_type (f.field_type, true);
+ var_decl.initializer = default_value_for_type (f.variable_type, true);
if (f.initializer != null) {
var rhs = (CCodeExpression) f.initializer.ccodenode;
@@ -673,21 +673,21 @@ internal class Vala.DovaBaseModule : CCodeModule {
}
void capture_parameter (FormalParameter param, CCodeStruct data, CCodeBlock cblock, int block_id, CCodeBlock free_block) {
- generate_type_declaration (param.parameter_type, source_declarations);
+ generate_type_declaration (param.variable_type, source_declarations);
- var param_type = param.parameter_type.copy ();
+ var param_type = param.variable_type.copy ();
param_type.value_owned = true;
data.add_field (param_type.get_cname (), get_variable_cname (param.name));
// create copy if necessary as captured variables may need to be kept alive
CCodeExpression cparam = get_variable_cexpression (param.name);
- if (requires_copy (param_type) && !param.parameter_type.value_owned) {
+ if (requires_copy (param_type) && !param.variable_type.value_owned) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- ma.value_type = param.parameter_type.copy ();
+ ma.value_type = param.variable_type.copy ();
// directly access parameters in ref expressions
param.captured = false;
- cparam = get_ref_cexpression (param.parameter_type, cparam, ma, param);
+ cparam = get_ref_cexpression (param.variable_type, cparam, ma, param);
param.captured = true;
}
@@ -697,7 +697,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
ma.value_type = param_type.copy ();
- free_block.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), get_variable_cname (param.name)), param.parameter_type, ma)));
+ free_block.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeMemberAccess.pointer (new CCodeIdentifier ("_data%d_".printf (block_id)), get_variable_cname (param.name)), param.variable_type, ma)));
}
}
@@ -893,10 +893,10 @@ internal class Vala.DovaBaseModule : CCodeModule {
if (b.parent_symbol is Method) {
var m = (Method) b.parent_symbol;
foreach (FormalParameter param in m.get_parameters ()) {
- if (!param.captured && requires_destroy (param.parameter_type) && param.direction == ParameterDirection.IN) {
+ if (!param.captured && requires_destroy (param.variable_type) && param.direction == ParameterDirection.IN) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (param.name), param.parameter_type, ma)));
+ cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (param.name), param.variable_type, ma)));
}
}
}
@@ -1447,10 +1447,10 @@ internal class Vala.DovaBaseModule : CCodeModule {
private void append_param_free (Method m, CCodeFragment cfrag) {
foreach (FormalParameter param in m.get_parameters ()) {
- if (requires_destroy (param.parameter_type) && param.direction == ParameterDirection.IN) {
+ if (requires_destroy (param.variable_type) && param.direction == ParameterDirection.IN) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- cfrag.append (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (param.name), param.parameter_type, ma)));
+ cfrag.append (new CCodeExpressionStatement (get_unref_expression (get_variable_cexpression (param.name), param.variable_type, ma)));
}
}
}
@@ -1827,7 +1827,7 @@ internal class Vala.DovaBaseModule : CCodeModule {
break;
}
- if (param.default_expression == null) {
+ if (param.initializer == null) {
Report.error (expr.source_reference, "no default expression for argument %d".printf (i));
return;
}
@@ -1835,9 +1835,9 @@ internal class Vala.DovaBaseModule : CCodeModule {
/* evaluate default expression here as the code
* generator might not have visited the formal
* parameter yet */
- param.default_expression.accept (codegen);
+ param.initializer.accept (codegen);
- creation_call.add_argument ((CCodeExpression) param.default_expression.ccodenode);
+ creation_call.add_argument ((CCodeExpression) param.initializer.ccodenode);
i++;
}
@@ -2278,11 +2278,11 @@ internal class Vala.DovaBaseModule : CCodeModule {
foreach (FormalParameter param in d.get_parameters ()) {
method_param_iter.next ();
var method_param = method_param_iter.get ();
- string ctype = param.parameter_type.get_cname ();
- if (param.parameter_type is GenericType && !(method_param.parameter_type is GenericType)) {
- ctype = method_param.parameter_type.get_cname () + "*";
+ string ctype = param.variable_type.get_cname ();
+ if (param.variable_type is GenericType && !(method_param.variable_type is GenericType)) {
+ ctype = method_param.variable_type.get_cname () + "*";
call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (param.name)));
- } else if (!(param.parameter_type is GenericType) && method_param.parameter_type is GenericType) {
+ } else if (!(param.variable_type is GenericType) && method_param.variable_type is GenericType) {
call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
} else {
call.add_argument (new CCodeIdentifier (param.name));
@@ -2449,9 +2449,9 @@ internal class Vala.DovaBaseModule : CCodeModule {
public DataType? get_this_type () {
if (current_method != null && current_method.binding == MemberBinding.INSTANCE) {
- return current_method.this_parameter.parameter_type;
+ return current_method.this_parameter.variable_type;
} else if (current_property_accessor != null && current_property_accessor.prop.binding == MemberBinding.INSTANCE) {
- return current_property_accessor.prop.this_parameter.parameter_type;
+ return current_property_accessor.prop.this_parameter.variable_type;
}
return null;
}
diff --git a/codegen/valadovadelegatemodule.vala b/codegen/valadovadelegatemodule.vala
index 6be32ec..9e361c4 100644
--- a/codegen/valadovadelegatemodule.vala
+++ b/codegen/valadovadelegatemodule.vala
@@ -109,14 +109,14 @@ internal class Vala.DovaDelegateModule : DovaValueModule {
string param_list = "";
foreach (FormalParameter param in d.get_parameters ()) {
- generate_type_declaration (param.parameter_type, decl_space);
+ generate_type_declaration (param.variable_type, decl_space);
- function.add_parameter (new CCodeFormalParameter (param.name, param.parameter_type.get_cname ()));
+ function.add_parameter (new CCodeFormalParameter (param.name, param.variable_type.get_cname ()));
if (param_list != "") {
param_list += ", ";
}
- param_list += param.parameter_type.get_cname ();
+ param_list += param.variable_type.get_cname ();
}
if (d.return_type is GenericType) {
diff --git a/codegen/valadovamemberaccessmodule.vala b/codegen/valadovamemberaccessmodule.vala
index c6ef7e4..3785932 100644
--- a/codegen/valadovamemberaccessmodule.vala
+++ b/codegen/valadovamemberaccessmodule.vala
@@ -237,10 +237,10 @@ internal class Vala.DovaMemberAccessModule : DovaControlFlowModule {
// use closure
expr.ccodenode = get_variable_cexpression (p.name);
} else {
- var type_as_struct = p.parameter_type.data_type as Struct;
+ var type_as_struct = p.variable_type.data_type as Struct;
if (p.direction != ParameterDirection.IN
- || (type_as_struct != null && !type_as_struct.is_simple_type () && !p.parameter_type.nullable)) {
- if (p.parameter_type is GenericType) {
+ || (type_as_struct != null && !type_as_struct.is_simple_type () && !p.variable_type.nullable)) {
+ if (p.variable_type is GenericType) {
expr.ccodenode = get_variable_cexpression (p.name);
} else {
expr.ccodenode = new CCodeIdentifier ("(*%s)".printf (get_variable_cname (p.name)));
diff --git a/codegen/valadovamethodcallmodule.vala b/codegen/valadovamethodcallmodule.vala
index 149bc89..ed4d571 100644
--- a/codegen/valadovamethodcallmodule.vala
+++ b/codegen/valadovamethodcallmodule.vala
@@ -134,13 +134,13 @@ internal class Vala.DovaMethodCallModule : DovaAssignmentModule {
// disabled for arrays for now as that requires special handling
// (ret_tmp = call (&tmp), var1 = (assign_tmp = dup (tmp), free (var1), assign_tmp), ret_tmp)
if (param.direction != ParameterDirection.IN && requires_destroy (arg.value_type)
- && (param.direction == ParameterDirection.OUT || !param.parameter_type.value_owned)
- && !(param.parameter_type is ArrayType)) {
+ && (param.direction == ParameterDirection.OUT || !param.variable_type.value_owned)
+ && !(param.variable_type is ArrayType)) {
var unary = (UnaryExpression) arg;
var ccomma = new CCodeCommaExpression ();
- var temp_var = get_temp_variable (param.parameter_type, param.parameter_type.value_owned);
+ var temp_var = get_temp_variable (param.variable_type, param.variable_type.value_owned);
temp_vars.insert (0, temp_var);
cexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, get_variable_cexpression (temp_var.name));
@@ -166,7 +166,7 @@ internal class Vala.DovaMethodCallModule : DovaAssignmentModule {
var assign_temp_var = get_temp_variable (unary.inner.value_type, unary.inner.value_type.value_owned);
temp_vars.insert (0, assign_temp_var);
- cassign_comma.append_expression (new CCodeAssignment (get_variable_cexpression (assign_temp_var.name), transform_expression (get_variable_cexpression (temp_var.name), param.parameter_type, unary.inner.value_type, arg)));
+ cassign_comma.append_expression (new CCodeAssignment (get_variable_cexpression (assign_temp_var.name), transform_expression (get_variable_cexpression (temp_var.name), param.variable_type, unary.inner.value_type, arg)));
// unref old value
cassign_comma.append_expression (get_unref_expression ((CCodeExpression) unary.inner.ccodenode, arg.value_type, arg));
diff --git a/codegen/valadovaobjectmodule.vala b/codegen/valadovaobjectmodule.vala
index 44e07ce..cf700fa 100644
--- a/codegen/valadovaobjectmodule.vala
+++ b/codegen/valadovaobjectmodule.vala
@@ -121,14 +121,14 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
foreach (Field f in cl.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
- generate_type_declaration (f.field_type, decl_space);
+ generate_type_declaration (f.variable_type, decl_space);
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
- instance_priv_struct.add_field (field_ctype, f.get_cname () + f.field_type.get_cdeclarator_suffix ());
+ instance_priv_struct.add_field (field_ctype, f.get_cname () + f.variable_type.get_cdeclarator_suffix ());
}
}
@@ -1277,7 +1277,7 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
string param_list = "(%s *this".printf (((ObjectTypeSymbol) m.parent_symbol).get_cname ());
foreach (var param in m.get_parameters ()) {
param_list += ", ";
- param_list += param.parameter_type.get_cname ();
+ param_list += param.variable_type.get_cname ();
}
if (m.return_type is GenericType) {
param_list += ", void *";
@@ -1402,7 +1402,7 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
break;
}
- var t = param.parameter_type.data_type;
+ var t = param.variable_type.data_type;
if (t != null && t.is_reference_type ()) {
if (param.direction == ParameterDirection.OUT) {
// ensure that the passed reference for output parameter is cleared
@@ -1449,7 +1449,7 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
vfunc.add_parameter (new CCodeFormalParameter ("%s_type".printf (type_param.name.down ()), "DovaType*"));
}
foreach (FormalParameter param in m.get_parameters ()) {
- string ctypename = param.parameter_type.get_cname ();
+ string ctypename = param.variable_type.get_cname ();
if (param.direction != ParameterDirection.IN) {
ctypename += "*";
}
@@ -1510,7 +1510,7 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
vfunc.add_parameter (new CCodeFormalParameter ("%s_type".printf (type_param.name.down ()), "DovaType*"));
}
foreach (FormalParameter param in m.get_parameters ()) {
- string ctypename = param.parameter_type.get_cname ();
+ string ctypename = param.variable_type.get_cname ();
if (param.direction != ParameterDirection.IN) {
ctypename += "*";
}
@@ -1548,7 +1548,7 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
string param_list = "(%s *this".printf (((ObjectTypeSymbol) m.parent_symbol).get_cname ());
foreach (var param in m.get_parameters ()) {
param_list += ", ";
- param_list += param.parameter_type.get_cname ();
+ param_list += param.variable_type.get_cname ();
}
if (m.return_type is GenericType) {
param_list += ", void *";
@@ -1688,11 +1688,11 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
// this is only a temporary measure until this can be allocated inline at the end of the instance
// this also won't work for subclasses of classes that have fields of generic types
foreach (var f in current_class.get_fields ()) {
- if (f.binding != MemberBinding.INSTANCE || !(f.field_type is GenericType)) {
+ if (f.binding != MemberBinding.INSTANCE || !(f.variable_type is GenericType)) {
continue;
}
- var generic_type = (GenericType) f.field_type;
+ var generic_type = (GenericType) f.variable_type;
var type_get_value_size = new CCodeFunctionCall (new CCodeIdentifier ("dova_type_get_value_size"));
type_get_value_size.add_argument (new CCodeIdentifier ("%s_type".printf (generic_type.type_parameter.name.down ())));
@@ -1807,11 +1807,11 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
foreach (FormalParameter param in m.get_parameters ()) {
CCodeFormalParameter cparam;
if (!param.ellipsis) {
- string ctypename = param.parameter_type.get_cname ();
+ string ctypename = param.variable_type.get_cname ();
- generate_type_declaration (param.parameter_type, decl_space);
+ generate_type_declaration (param.variable_type, decl_space);
- if (param.direction != ParameterDirection.IN && !(param.parameter_type is GenericType)) {
+ if (param.direction != ParameterDirection.IN && !(param.variable_type is GenericType)) {
ctypename += "*";
}
diff --git a/codegen/valadovastructmodule.vala b/codegen/valadovastructmodule.vala
index 1497a3a..fa01e50 100644
--- a/codegen/valadovastructmodule.vala
+++ b/codegen/valadovastructmodule.vala
@@ -56,15 +56,15 @@ internal class Vala.DovaStructModule : DovaBaseModule {
var instance_struct = new CCodeStruct ("_%s".printf (st.get_cname ()));
foreach (Field f in st.get_fields ()) {
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
if (f.binding == MemberBinding.INSTANCE) {
- generate_type_declaration (f.field_type, decl_space);
+ generate_type_declaration (f.variable_type, decl_space);
- instance_struct.add_field (field_ctype, f.get_cname () + f.field_type.get_cdeclarator_suffix ());
+ instance_struct.add_field (field_ctype, f.get_cname () + f.variable_type.get_cdeclarator_suffix ());
}
}
diff --git a/codegen/valadovavaluemodule.vala b/codegen/valadovavaluemodule.vala
index fb3907f..ba9d211 100644
--- a/codegen/valadovavaluemodule.vala
+++ b/codegen/valadovavaluemodule.vala
@@ -301,7 +301,7 @@ internal class Vala.DovaValueModule : DovaObjectModule {
if (f.binding == MemberBinding.INSTANCE) {
var field = new CCodeMemberAccess.pointer (dest, f.name);
- var array_type = f.field_type as ArrayType;
+ var array_type = f.variable_type as ArrayType;
if (array_type != null && array_type.fixed_length) {
for (int i = 0; i < array_type.length; i++) {
var element = new CCodeElementAccess (field, new CCodeConstant (i.to_string ()));
@@ -313,14 +313,14 @@ internal class Vala.DovaValueModule : DovaObjectModule {
continue;
}
- if (requires_destroy (f.field_type)) {
+ if (requires_destroy (f.variable_type)) {
var this_access = new MemberAccess.simple ("this");
this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
this_access.ccodenode = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, dest);
var ma = new MemberAccess (this_access, f.name);
ma.symbol_reference = f;
- ma.value_type = f.field_type.copy ();
- cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (field, f.field_type, ma)));
+ ma.value_type = f.variable_type.copy ();
+ cblock.add_statement (new CCodeExpressionStatement (get_unref_expression (field, f.variable_type, ma)));
}
}
}
@@ -335,7 +335,7 @@ internal class Vala.DovaValueModule : DovaObjectModule {
CCodeExpression copy = new CCodeMemberAccess.pointer (src, f.name);
var dest_field = new CCodeMemberAccess.pointer (dest, f.name);
- var array_type = f.field_type as ArrayType;
+ var array_type = f.variable_type as ArrayType;
if (array_type != null && array_type.fixed_length) {
for (int i = 0; i < array_type.length; i++) {
CCodeExpression copy_element = new CCodeElementAccess (copy, new CCodeConstant (i.to_string ()));
@@ -350,13 +350,13 @@ internal class Vala.DovaValueModule : DovaObjectModule {
continue;
}
- if (requires_copy (f.field_type)) {
+ if (requires_copy (f.variable_type)) {
var this_access = new MemberAccess.simple ("this");
this_access.value_type = get_data_type_for_symbol ((TypeSymbol) f.parent_symbol);
this_access.ccodenode = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, src);
var ma = new MemberAccess (this_access, f.name);
ma.symbol_reference = f;
- copy = get_ref_cexpression (f.field_type, copy, ma, f);
+ copy = get_ref_cexpression (f.variable_type, copy, ma, f);
}
copy_block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (dest_field, copy)));
diff --git a/codegen/valagasyncmodule.vala b/codegen/valagasyncmodule.vala
index ebb142e..c406b4b 100644
--- a/codegen/valagasyncmodule.vala
+++ b/codegen/valagasyncmodule.vala
@@ -41,17 +41,17 @@ public class Vala.GAsyncModule : GSignalModule {
}
foreach (FormalParameter param in m.get_parameters ()) {
- var param_type = param.parameter_type.copy ();
+ var param_type = param.variable_type.copy ();
param_type.value_owned = true;
data.add_field (param_type.get_cname (), get_variable_cname (param.name));
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ 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_array_length_cname (get_variable_cname (param.name), dim));
}
- } else if (param.parameter_type is DelegateType) {
- var deleg_type = (DelegateType) param.parameter_type;
+ } else if (param.variable_type is DelegateType) {
+ var deleg_type = (DelegateType) param.variable_type;
if (deleg_type.delegate_symbol.has_target) {
data.add_field ("gpointer", get_delegate_target_cname (get_variable_cname (param.name)));
data.add_field ("GDestroyNotify", get_delegate_target_destroy_notify_cname (get_variable_cname (param.name)));
@@ -97,14 +97,14 @@ public class Vala.GAsyncModule : GSignalModule {
foreach (FormalParameter param in m.get_parameters ()) {
if (param.direction != ParameterDirection.OUT) {
- var param_type = param.parameter_type.copy ();
+ var param_type = param.variable_type.copy ();
param_type.value_owned = true;
if (requires_destroy (param_type)) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- ma.value_type = param.parameter_type.copy ();
- freeblock.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_variable_cname (param.name)), param.parameter_type, ma)));
+ ma.value_type = param.variable_type.copy ();
+ freeblock.add_statement (new CCodeExpressionStatement (get_unref_expression (new CCodeMemberAccess.pointer (new CCodeIdentifier ("data"), get_variable_cname (param.name)), param.variable_type, ma)));
}
}
}
@@ -225,28 +225,28 @@ public class Vala.GAsyncModule : GSignalModule {
foreach (FormalParameter param in m.get_parameters ()) {
if (param.direction != ParameterDirection.OUT) {
- var param_type = param.parameter_type.copy ();
+ var param_type = param.variable_type.copy ();
param_type.value_owned = true;
// create copy if necessary as variables in async methods may need to be kept alive
CCodeExpression cparam = get_variable_cexpression (param.name);
- if (param.parameter_type.is_real_non_null_struct_type ()) {
+ if (param.variable_type.is_real_non_null_struct_type ()) {
cparam = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, cparam);
}
- if (requires_copy (param_type) && !param.parameter_type.value_owned) {
+ if (requires_copy (param_type) && !param.variable_type.value_owned) {
var ma = new MemberAccess.simple (param.name);
ma.symbol_reference = param;
- cparam = get_ref_cexpression (param.parameter_type, cparam, ma, param);
+ cparam = get_ref_cexpression (param.variable_type, cparam, ma, param);
}
asyncblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)), cparam)));
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
asyncblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, 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.parameter_type is DelegateType) {
- var deleg_type = (DelegateType) param.parameter_type;
+ } else if (param.variable_type is DelegateType) {
+ var deleg_type = (DelegateType) param.variable_type;
if (deleg_type.delegate_symbol.has_target) {
asyncblock.add_statement (new CCodeExpressionStatement (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))))));
if (deleg_type.value_owned) {
@@ -432,7 +432,7 @@ public class Vala.GAsyncModule : GSignalModule {
foreach (FormalParameter param in m.get_parameters ()) {
if (param.direction != ParameterDirection.IN) {
finishblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier (param.name)), new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)))));
- if (!(param.parameter_type is ValueType) || param.parameter_type.nullable) {
+ if (!(param.variable_type is ValueType) || param.variable_type.nullable) {
finishblock.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeMemberAccess.pointer (data_var, get_variable_cname (param.name)), new CCodeConstant ("NULL"))));
}
}
diff --git a/codegen/valagdbusclientmodule.vala b/codegen/valagdbusclientmodule.vala
index 1113df6..cd4a0ff 100644
--- a/codegen/valagdbusclientmodule.vala
+++ b/codegen/valagdbusclientmodule.vala
@@ -315,22 +315,22 @@ public class Vala.GDBusClientModule : GDBusModule {
ccall.add_argument (sig.get_canonical_cconstant ());
foreach (FormalParameter param in sig.get_parameters ()) {
- var owned_type = param.parameter_type.copy ();
+ var owned_type = param.variable_type.copy ();
owned_type.value_owned = true;
cdecl = new CCodeDeclaration (owned_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.zero (param.name, default_value_for_type (param.parameter_type, true)));
+ cdecl.add_declarator (new CCodeVariableDeclarator.zero (param.name, default_value_for_type (param.variable_type, true)));
prefragment.append (cdecl);
- var st = param.parameter_type.data_type as Struct;
+ var st = param.variable_type.data_type as Struct;
if (st != null && !st.is_simple_type ()) {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
} else {
ccall.add_argument (new CCodeIdentifier (param.name));
}
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
string length_cname = get_array_length_cname (param.name, dim);
@@ -342,7 +342,7 @@ public class Vala.GDBusClientModule : GDBusModule {
}
}
- read_expression (prefragment, param.parameter_type, new CCodeIdentifier ("_arguments_iter"), new CCodeIdentifier (param.name), param);
+ read_expression (prefragment, param.variable_type, new CCodeIdentifier ("_arguments_iter"), new CCodeIdentifier (param.name), param);
if (requires_destroy (owned_type)) {
// keep local alive (symbol_reference is weak)
@@ -436,16 +436,16 @@ public class Vala.GDBusClientModule : GDBusModule {
foreach (FormalParameter param in m.get_parameters ()) {
if (param.direction == ParameterDirection.IN) {
CCodeExpression expr = new CCodeIdentifier (param.name);
- if (param.parameter_type.is_real_struct_type ()) {
+ if (param.variable_type.is_real_struct_type ()) {
expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, expr);
}
- write_expression (prefragment, param.parameter_type, new CCodeIdentifier ("_arguments_builder"), expr, param);
+ write_expression (prefragment, param.variable_type, new CCodeIdentifier ("_arguments_builder"), expr, param);
} else {
- cdecl = new CCodeDeclaration (param.parameter_type.get_cname ());
+ cdecl = new CCodeDeclaration (param.variable_type.get_cname ());
cdecl.add_declarator (new CCodeVariableDeclarator ("_" + param.name));
postfragment.append (cdecl);
- var array_type = param.parameter_type as ArrayType;
+ var array_type = param.variable_type as ArrayType;
if (array_type != null) {
for (int dim = 1; dim <= array_type.rank; dim++) {
@@ -456,7 +456,7 @@ public class Vala.GDBusClientModule : GDBusModule {
}
var target = new CCodeIdentifier ("_" + param.name);
- read_expression (postfragment, param.parameter_type, new CCodeIdentifier ("_reply_iter"), target, param);
+ read_expression (postfragment, param.variable_type, new CCodeIdentifier ("_reply_iter"), target, param);
// TODO check that parameter is not NULL (out parameters are optional)
// free value if parameter is NULL
diff --git a/codegen/valagdbusservermodule.vala b/codegen/valagdbusservermodule.vala
index 1864a1a..2680a86 100644
--- a/codegen/valagdbusservermodule.vala
+++ b/codegen/valagdbusservermodule.vala
@@ -137,11 +137,11 @@ public class Vala.GDBusServerModule : GDBusClientModule {
ccall.add_argument (new CCodeIdentifier ("self"));
foreach (FormalParameter param in m.get_parameters ()) {
- var owned_type = param.parameter_type.copy ();
+ var owned_type = param.variable_type.copy ();
owned_type.value_owned = true;
cdecl = new CCodeDeclaration (owned_type.get_cname ());
- cdecl.add_declarator (new CCodeVariableDeclarator.zero (param.name, default_value_for_type (param.parameter_type, true)));
+ cdecl.add_declarator (new CCodeVariableDeclarator.zero (param.name, default_value_for_type (param.variable_type, true)));
if (param.direction == ParameterDirection.IN) {
in_prefragment.append (cdecl);
} else {
@@ -149,7 +149,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
}
if (!m.coroutine || param.direction == ParameterDirection.IN) {
- var st = param.parameter_type.data_type as Struct;
+ var st = param.variable_type.data_type as Struct;
if (param.direction != ParameterDirection.IN
|| (st != null && !st.is_simple_type ())) {
ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
@@ -160,8 +160,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
finish_ccall.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, new CCodeIdentifier (param.name)));
}
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
string length_cname = get_array_length_cname (param.name, dim);
@@ -184,9 +184,9 @@ public class Vala.GDBusServerModule : GDBusClientModule {
}
if (param.direction == ParameterDirection.IN) {
- read_expression (in_prefragment, param.parameter_type, new CCodeIdentifier ("_arguments_iter"), new CCodeIdentifier (param.name), param);
+ read_expression (in_prefragment, param.variable_type, new CCodeIdentifier ("_arguments_iter"), new CCodeIdentifier (param.name), param);
} else {
- write_expression (out_postfragment, param.parameter_type, new CCodeIdentifier ("_reply_builder"), new CCodeIdentifier (param.name), param);
+ write_expression (out_postfragment, param.variable_type, new CCodeIdentifier ("_reply_builder"), new CCodeIdentifier (param.name), param);
}
if (requires_destroy (owned_type)) {
@@ -370,8 +370,8 @@ public class Vala.GDBusServerModule : GDBusClientModule {
generate_parameter (param, source_declarations, new HashMap<int,CCodeFormalParameter> (), null);
function.add_parameter ((CCodeFormalParameter) get_ccodenode (param));
- if (param.parameter_type is ArrayType) {
- var array_type = (ArrayType) param.parameter_type;
+ if (param.variable_type is ArrayType) {
+ var array_type = (ArrayType) param.variable_type;
for (int dim = 1; dim <= array_type.rank; dim++) {
function.add_parameter (new CCodeFormalParameter (head.get_array_length_cname (param.name, dim), "int"));
}
@@ -406,10 +406,10 @@ public class Vala.GDBusServerModule : GDBusClientModule {
foreach (FormalParameter param in sig.get_parameters ()) {
CCodeExpression expr = new CCodeIdentifier (param.name);
- if (param.parameter_type.is_real_struct_type ()) {
+ if (param.variable_type.is_real_struct_type ()) {
expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, expr);
}
- write_expression (prefragment, param.parameter_type, new CCodeIdentifier ("_arguments_builder"), expr, param);
+ write_expression (prefragment, param.variable_type, new CCodeIdentifier ("_arguments_builder"), expr, param);
}
var builder_end = new CCodeFunctionCall (new CCodeIdentifier ("g_variant_builder_end"));
@@ -823,7 +823,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
var info = new CCodeInitializerList ();
info.append (new CCodeConstant ("-1"));
info.append (new CCodeConstant ("\"%s\"".printf (param.name)));
- info.append (new CCodeConstant ("\"%s\"".printf (get_type_signature (param.parameter_type, param))));
+ info.append (new CCodeConstant ("\"%s\"".printf (get_type_signature (param.variable_type, param))));
var cdecl = new CCodeDeclaration ("const GDBusArgInfo");
cdecl.add_declarator (new CCodeVariableDeclarator ("_" + sym.get_lower_case_cprefix () + "dbus_arg_info_" + m.name + "_" + param.name, info));
@@ -905,7 +905,7 @@ public class Vala.GDBusServerModule : GDBusClientModule {
var info = new CCodeInitializerList ();
info.append (new CCodeConstant ("-1"));
info.append (new CCodeConstant ("\"%s\"".printf (param.name)));
- info.append (new CCodeConstant ("\"%s\"".printf (get_type_signature (param.parameter_type, param))));
+ info.append (new CCodeConstant ("\"%s\"".printf (get_type_signature (param.variable_type, param))));
var cdecl = new CCodeDeclaration ("const GDBusArgInfo");
cdecl.add_declarator (new CCodeVariableDeclarator ("_" + sym.get_lower_case_cprefix () + "dbus_arg_info_" + sig.get_cname () + "_" + param.name, info));
diff --git a/codegen/valagirwriter.vala b/codegen/valagirwriter.vala
index 601583c..e1899de 100644
--- a/codegen/valagirwriter.vala
+++ b/codegen/valagirwriter.vala
@@ -514,7 +514,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_indent ();
buffer.append_printf ("<field name=\"%s\"", f.get_cname ());
- if (f.field_type.nullable) {
+ if (f.variable_type.nullable) {
buffer.append_printf (" allow-none=\"1\"");
}
buffer.append_printf (">\n");
@@ -522,7 +522,7 @@ public class Vala.GIRWriter : CodeVisitor {
write_annotations (f);
- write_type (f.field_type);
+ write_type (f.variable_type);
indent--;
write_indent ();
@@ -556,9 +556,9 @@ public class Vala.GIRWriter : CodeVisitor {
}
foreach (FormalParameter param in params) {
- write_param_or_return (param.parameter_type, "parameter", ref index, !param.no_array_length, param.name, param.direction);
+ write_param_or_return (param.variable_type, "parameter", ref index, !param.no_array_length, param.name, param.direction);
- write_implicit_params (param.parameter_type, ref index, !param.no_array_length, param.name, param.direction);
+ write_implicit_params (param.variable_type, ref index, !param.no_array_length, param.name, param.direction);
}
last_index = index - 1;
diff --git a/codegen/valagsignalmodule.vala b/codegen/valagsignalmodule.vala
index 4b17a81..d62b30d 100644
--- a/codegen/valagsignalmodule.vala
+++ b/codegen/valagsignalmodule.vala
@@ -67,7 +67,7 @@ public class Vala.GSignalModule : GObjectModule {
if (param.direction != ParameterDirection.IN) {
return ("POINTER");
} else {
- return get_marshaller_type_name (param.parameter_type, dbus);
+ return get_marshaller_type_name (param.variable_type, dbus);
}
}
@@ -127,7 +127,7 @@ public class Vala.GSignalModule : GObjectModule {
if (p.direction != ParameterDirection.IN) {
return "gpointer";
} else {
- return get_value_type_name_from_type_reference (p.parameter_type);
+ return get_value_type_name_from_type_reference (p.variable_type);
}
}
@@ -212,7 +212,7 @@ public class Vala.GSignalModule : GObjectModule {
foreach (FormalParameter p in params) {
callback_decl.add_parameter (new CCodeFormalParameter ("arg_%d".printf (n_params), get_value_type_name_from_parameter (p)));
n_params++;
- if (p.parameter_type.is_array () && !dbus) {
+ if (p.variable_type.is_array () && !dbus) {
callback_decl.add_parameter (new CCodeFormalParameter ("arg_%d".printf (n_params), "gint"));
n_params++;
}
@@ -272,34 +272,34 @@ public class Vala.GSignalModule : GObjectModule {
i = 1;
foreach (FormalParameter p in params) {
string get_value_function;
- bool is_array = p.parameter_type.is_array ();
+ bool is_array = p.variable_type.is_array ();
if (p.direction != ParameterDirection.IN) {
get_value_function = "g_value_get_pointer";
} else if (is_array) {
if (dbus) {
get_value_function = "g_value_get_boxed";
} else {
- if (((ArrayType) p.parameter_type).element_type.data_type == string_type.data_type) {
+ if (((ArrayType) p.variable_type).element_type.data_type == string_type.data_type) {
get_value_function = "g_value_get_boxed";
} else {
get_value_function = "g_value_get_pointer";
}
}
- } else if (p.parameter_type is PointerType || p.parameter_type.type_parameter != null) {
+ } else if (p.variable_type is PointerType || p.variable_type.type_parameter != null) {
get_value_function = "g_value_get_pointer";
- } else if (p.parameter_type is ErrorType) {
+ } else if (p.variable_type is ErrorType) {
get_value_function = "g_value_get_pointer";
- } else if (dbus && DBusModule.get_type_signature (p.parameter_type).has_prefix ("(")) {
+ } else if (dbus && DBusModule.get_type_signature (p.variable_type).has_prefix ("(")) {
get_value_function = "g_value_get_boxed";
- } else if (dbus && p.parameter_type.data_type is Enum) {
- var en = (Enum) p.parameter_type.data_type;
+ } else if (dbus && p.variable_type.data_type is Enum) {
+ var en = (Enum) p.variable_type.data_type;
if (en.is_flags) {
get_value_function = "g_value_get_uint";
} else {
get_value_function = "g_value_get_int";
}
} else {
- get_value_function = p.parameter_type.data_type.get_get_value_function ();
+ get_value_function = p.variable_type.data_type.get_get_value_function ();
}
var inner_fc = new CCodeFunctionCall (new CCodeIdentifier (get_value_function));
inner_fc.add_argument (new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, new CCodeIdentifier ("param_values"), new CCodeIdentifier (i.to_string ())));
@@ -423,26 +423,26 @@ public class Vala.GSignalModule : GObjectModule {
int params_len = 0;
foreach (FormalParameter param in params) {
params_len++;
- if (param.parameter_type.is_array ()) {
+ if (param.variable_type.is_array ()) {
params_len++;
}
}
csignew.add_argument (new CCodeConstant ("%d".printf (params_len)));
foreach (FormalParameter param in params) {
- if (param.parameter_type.is_array ()) {
- if (((ArrayType) param.parameter_type).element_type.data_type == string_type.data_type) {
+ if (param.variable_type.is_array ()) {
+ if (((ArrayType) param.variable_type).element_type.data_type == string_type.data_type) {
csignew.add_argument (new CCodeConstant ("G_TYPE_STRV"));
} else {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
}
csignew.add_argument (new CCodeConstant ("G_TYPE_INT"));
- } else if (param.parameter_type is PointerType || param.parameter_type.type_parameter != null || param.direction != ParameterDirection.IN) {
+ } else if (param.variable_type is PointerType || param.variable_type.type_parameter != null || param.direction != ParameterDirection.IN) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
- } else if (param.parameter_type is ErrorType) {
+ } else if (param.variable_type is ErrorType) {
csignew.add_argument (new CCodeConstant ("G_TYPE_POINTER"));
} else {
- csignew.add_argument (new CCodeConstant (param.parameter_type.data_type.get_type_id ()));
+ csignew.add_argument (new CCodeConstant (param.variable_type.data_type.get_type_id ()));
}
}
@@ -478,7 +478,7 @@ public class Vala.GSignalModule : GObjectModule {
bool in_gobject_instance (Method m) {
bool result = false;
if (m.binding == MemberBinding.INSTANCE) {
- result = m.this_parameter.parameter_type.data_type.is_subtype_of (gobject_type);
+ result = m.this_parameter.variable_type.data_type.is_subtype_of (gobject_type);
}
return result;
}
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 50c7cdc..e2a001e 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -29,14 +29,14 @@ public class Vala.GTypeModule : GErrorModule {
}
public override void generate_parameter (FormalParameter param, CCodeDeclarationSpace decl_space, Map<int,CCodeFormalParameter> cparam_map, Map<int,CCodeExpression>? carg_map) {
- if (!(param.parameter_type is ObjectType)) {
+ if (!(param.variable_type is ObjectType)) {
base.generate_parameter (param, decl_space, cparam_map, carg_map);
return;
}
- generate_type_declaration (param.parameter_type, decl_space);
+ generate_type_declaration (param.variable_type, decl_space);
- string ctypename = param.parameter_type.get_cname ();
+ string ctypename = param.variable_type.get_cname ();
if (param.direction != ParameterDirection.IN) {
ctypename += "*";
@@ -302,19 +302,19 @@ public class Vala.GTypeModule : GErrorModule {
}
foreach (Field f in cl.get_fields ()) {
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
if (f.access != SymbolAccessibility.PRIVATE) {
if (f.binding == MemberBinding.INSTANCE) {
- generate_type_declaration (f.field_type, decl_space);
+ generate_type_declaration (f.variable_type, decl_space);
- instance_struct.add_field (field_ctype, f.get_cname (), f.field_type.get_cdeclarator_suffix ());
- if (f.field_type is ArrayType && !f.no_array_length) {
+ instance_struct.add_field (field_ctype, f.get_cname (), f.variable_type.get_cdeclarator_suffix ());
+ if (f.variable_type is ArrayType && !f.no_array_length) {
// create fields to store array dimensions
- var array_type = (ArrayType) f.field_type;
+ var array_type = (ArrayType) f.variable_type;
if (!array_type.fixed_length) {
var len_type = int_type.copy ();
@@ -327,8 +327,8 @@ public class Vala.GTypeModule : GErrorModule {
instance_struct.add_field (len_type.get_cname (), head.get_array_size_cname (f.name));
}
}
- } else if (f.field_type is DelegateType) {
- var delegate_type = (DelegateType) f.field_type;
+ } else if (f.variable_type is DelegateType) {
+ var delegate_type = (DelegateType) f.variable_type;
if (delegate_type.delegate_symbol.has_target) {
// create field to store delegate target
instance_struct.add_field ("gpointer", get_delegate_target_cname (f.name));
@@ -404,19 +404,19 @@ public class Vala.GTypeModule : GErrorModule {
}
foreach (Field f in cl.get_fields ()) {
- string field_ctype = f.field_type.get_cname ();
+ string field_ctype = f.variable_type.get_cname ();
if (f.is_volatile) {
field_ctype = "volatile " + field_ctype;
}
if (f.binding == MemberBinding.INSTANCE) {
if (f.access == SymbolAccessibility.PRIVATE) {
- generate_type_declaration (f.field_type, decl_space);
+ generate_type_declaration (f.variable_type, decl_space);
- instance_priv_struct.add_field (field_ctype, f.get_cname (), f.field_type.get_cdeclarator_suffix ());
- if (f.field_type is ArrayType && !f.no_array_length) {
+ instance_priv_struct.add_field (field_ctype, f.get_cname (), f.variable_type.get_cdeclarator_suffix ());
+ if (f.variable_type is ArrayType && !f.no_array_length) {
// create fields to store array dimensions
- var array_type = (ArrayType) f.field_type;
+ var array_type = (ArrayType) f.variable_type;
var len_type = int_type.copy ();
if (!array_type.fixed_length) {
@@ -428,8 +428,8 @@ public class Vala.GTypeModule : GErrorModule {
instance_priv_struct.add_field (len_type.get_cname (), head.get_array_size_cname (f.name));
}
}
- } else if (f.field_type is DelegateType) {
- var delegate_type = (DelegateType) f.field_type;
+ } else if (f.variable_type is DelegateType) {
+ var delegate_type = (DelegateType) f.variable_type;
if (delegate_type.delegate_symbol.has_target) {
// create field to store delegate target
instance_priv_struct.add_field ("gpointer", get_delegate_target_cname (f.name));
@@ -1662,8 +1662,8 @@ public class Vala.GTypeModule : GErrorModule {
}
}
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant (prop.property_type.data_type.get_default_value ()));
}
@@ -1673,8 +1673,8 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_int");
cspec.add_argument (new CCodeConstant ("G_MININT"));
cspec.add_argument (new CCodeConstant ("G_MAXINT"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0"));
}
@@ -1682,8 +1682,8 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_uint");
cspec.add_argument (new CCodeConstant ("0"));
cspec.add_argument (new CCodeConstant ("G_MAXUINT"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0U"));
}
@@ -1691,8 +1691,8 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_int64");
cspec.add_argument (new CCodeConstant ("G_MININT64"));
cspec.add_argument (new CCodeConstant ("G_MAXINT64"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0"));
}
@@ -1700,8 +1700,8 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_uint64");
cspec.add_argument (new CCodeConstant ("0"));
cspec.add_argument (new CCodeConstant ("G_MAXUINT64"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0U"));
}
@@ -1709,8 +1709,8 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_long");
cspec.add_argument (new CCodeConstant ("G_MINLONG"));
cspec.add_argument (new CCodeConstant ("G_MAXLONG"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0L"));
}
@@ -1718,15 +1718,15 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_ulong");
cspec.add_argument (new CCodeConstant ("0"));
cspec.add_argument (new CCodeConstant ("G_MAXULONG"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0UL"));
}
} else if (st.get_type_id () == "G_TYPE_BOOLEAN") {
cspec.call = new CCodeIdentifier ("g_param_spec_boolean");
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("FALSE"));
}
@@ -1734,8 +1734,8 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_char");
cspec.add_argument (new CCodeConstant ("G_MININT8"));
cspec.add_argument (new CCodeConstant ("G_MAXINT8"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0"));
}
@@ -1743,8 +1743,8 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_uchar");
cspec.add_argument (new CCodeConstant ("0"));
cspec.add_argument (new CCodeConstant ("G_MAXUINT8"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0"));
}
@@ -1752,8 +1752,8 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_float");
cspec.add_argument (new CCodeConstant ("-G_MAXFLOAT"));
cspec.add_argument (new CCodeConstant ("G_MAXFLOAT"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0.0F"));
}
@@ -1761,15 +1761,15 @@ public class Vala.GTypeModule : GErrorModule {
cspec.call = new CCodeIdentifier ("g_param_spec_double");
cspec.add_argument (new CCodeConstant ("-G_MAXDOUBLE"));
cspec.add_argument (new CCodeConstant ("G_MAXDOUBLE"));
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("0.0"));
}
} else if (st.get_type_id () == "G_TYPE_GTYPE") {
cspec.call = new CCodeIdentifier ("g_param_spec_gtype");
- if (prop.default_expression != null) {
- cspec.add_argument ((CCodeExpression) prop.default_expression.ccodenode);
+ if (prop.initializer != null) {
+ cspec.add_argument ((CCodeExpression) prop.initializer.ccodenode);
} else {
cspec.add_argument (new CCodeConstant ("G_TYPE_NONE"));
}
diff --git a/codegen/valagvariantmodule.vala b/codegen/valagvariantmodule.vala
index 0694edf..e44c495 100644
--- a/codegen/valagvariantmodule.vala
+++ b/codegen/valagvariantmodule.vala
@@ -122,7 +122,7 @@ public class Vala.GVariantModule : GAsyncModule {
str.append_c ('(');
foreach (Field f in st.get_fields ()) {
if (f.binding == MemberBinding.INSTANCE) {
- str.append (get_type_signature (f.field_type));
+ str.append (get_type_signature (f.variable_type));
}
}
str.append_c (')');
@@ -397,7 +397,7 @@ public class Vala.GVariantModule : GAsyncModule {
field_found = true;
- read_expression (fragment, f.field_type, new CCodeIdentifier (subiter_name), new CCodeMemberAccess (new CCodeIdentifier (temp_name), f.get_cname ()), f);
+ read_expression (fragment, f.variable_type, new CCodeIdentifier (subiter_name), new CCodeMemberAccess (new CCodeIdentifier (temp_name), f.get_cname ()), f);
}
if (!field_found) {
@@ -685,7 +685,7 @@ public class Vala.GVariantModule : GAsyncModule {
field_found = true;
- write_expression (fragment, f.field_type, new CCodeIdentifier (builder_name), new CCodeMemberAccess (struct_expr, f.get_cname ()), f);
+ write_expression (fragment, f.variable_type, new CCodeIdentifier (builder_name), new CCodeMemberAccess (struct_expr, f.get_cname ()), f);
}
if (!field_found) {
diff --git a/vala/Makefile.am b/vala/Makefile.am
index 1dc0ca8..7148e44 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -156,6 +156,7 @@ libvalacore_la_VALASOURCES = \
valaunresolvedtype.vala \
valausingdirective.vala \
valavaluetype.vala \
+ valavariable.vala \
valavoidtype.vala \
valawhilestatement.vala \
valayieldstatement.vala \
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index c1d9e0e..ee57df5 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -88,9 +88,9 @@ public class Vala.ArrayType : ReferenceType {
if (rank > 1) {
// length is an int[] containing the dimensions of the array, starting at 0
ValueType integer = new IntegerType ((Struct) root_symbol.scope.lookup ("int"));
- length_field.field_type = new ArrayType (integer, 1, source_reference);
+ length_field.variable_type = new ArrayType (integer, 1, source_reference);
} else {
- length_field.field_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int"));
+ length_field.variable_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int"));
}
}
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 7cb5b1f..66c9316 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -347,9 +347,9 @@ public class Vala.Assignment : Expression {
var f = (Field) ma.symbol_reference;
if (right.symbol_reference is Method &&
- f.field_type is DelegateType) {
+ f.variable_type is DelegateType) {
var m = (Method) right.symbol_reference;
- var dt = (DelegateType) f.field_type;
+ var dt = (DelegateType) f.variable_type;
var cb = dt.delegate_symbol;
/* check whether method matches callback type */
@@ -359,7 +359,7 @@ public class Vala.Assignment : Expression {
return false;
}
- right.value_type = f.field_type;
+ right.value_type = f.variable_type;
} else {
error = true;
Report.error (source_reference, "Assignment: Invalid callback assignment attempt");
diff --git a/vala/valaclass.vala b/vala/valaclass.vala
index fb0ce37..1fb5798 100644
--- a/vala/valaclass.vala
+++ b/vala/valaclass.vala
@@ -291,7 +291,7 @@ public class Vala.Class : ObjectTypeSymbol {
name != "any" /* temporary workaround */) {
// public/protected instance fields not supported, convert to automatic property
- var prop = new Property (f.name, f.field_type.copy (), null, null, f.source_reference, comment);
+ var prop = new Property (f.name, f.variable_type.copy (), null, null, f.source_reference, comment);
prop.access = access;
var get_type = prop.property_type.copy ();
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index e725458..89d848f 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -673,7 +673,7 @@ public class Vala.CodeWriter : CodeVisitor {
bool custom_cheaders = (f.parent_symbol is Namespace);
bool custom_array_length_cname = (f.get_array_length_cname () != null);
bool custom_array_length_type = (f.array_length_type != null);
- if (custom_cname || custom_ctype || custom_cheaders || custom_array_length_cname || custom_array_length_type || (f.no_array_length && f.field_type is ArrayType)) {
+ if (custom_cname || custom_ctype || custom_cheaders || custom_array_length_cname || custom_array_length_type || (f.no_array_length && f.variable_type is ArrayType)) {
write_indent ();
write_string ("[CCode (");
@@ -697,7 +697,7 @@ public class Vala.CodeWriter : CodeVisitor {
write_string ("cheader_filename = \"%s\"".printf (get_cheaders(f)));
}
- if (f.field_type is ArrayType) {
+ if (f.variable_type is ArrayType) {
if (f.no_array_length) {
if (custom_cname || custom_ctype || custom_cheaders) {
write_string (", ");
@@ -739,11 +739,11 @@ public class Vala.CodeWriter : CodeVisitor {
write_string ("class ");
}
- if (is_weak (f.field_type)) {
+ if (is_weak (f.variable_type)) {
write_string ("weak ");
}
- write_type (f.field_type);
+ write_type (f.variable_type);
write_string (" ");
write_identifier (f.name);
@@ -799,11 +799,11 @@ public class Vala.CodeWriter : CodeVisitor {
ccode_params.append_printf ("%stype = \"%s\"", separator, param.ctype);
separator = ", ";
}
- if (param.no_array_length && param.parameter_type is ArrayType) {
+ if (param.no_array_length && param.variable_type is ArrayType) {
ccode_params.append_printf ("%sarray_length = false", separator);
separator = ", ";
}
- if (param.array_length_type != null && param.parameter_type is ArrayType) {
+ if (param.array_length_type != null && param.variable_type is ArrayType) {
ccode_params.append_printf ("%sarray_length_type = \"%s\"", separator, param.array_length_type);
separator = ", ";
}
@@ -825,7 +825,7 @@ public class Vala.CodeWriter : CodeVisitor {
}
if (param.direction == ParameterDirection.IN) {
- if (param.parameter_type.value_owned) {
+ if (param.variable_type.value_owned) {
write_string ("owned ");
}
} else {
@@ -834,19 +834,19 @@ public class Vala.CodeWriter : CodeVisitor {
} else if (param.direction == ParameterDirection.OUT) {
write_string ("out ");
}
- if (is_weak (param.parameter_type)) {
+ if (is_weak (param.variable_type)) {
write_string ("unowned ");
}
}
- write_type (param.parameter_type);
+ write_type (param.variable_type);
write_string (" ");
write_identifier (param.name);
- if (param.default_expression != null) {
+ if (param.initializer != null) {
write_string (" = ");
- write_string (param.default_expression.to_string ());
+ write_string (param.initializer.to_string ());
}
i++;
diff --git a/vala/valadelegate.vala b/vala/valadelegate.vala
index 85ada07..27c660c 100644
--- a/vala/valadelegate.vala
+++ b/vala/valadelegate.vala
@@ -171,7 +171,7 @@ public class Vala.Delegate : TypeSymbol {
// method is allowed to accept arguments of looser types (weaker precondition)
var method_param = method_params_it.get ();
- if (!sender_type.stricter (method_param.parameter_type)) {
+ if (!sender_type.stricter (method_param.variable_type)) {
return false;
}
}
@@ -194,7 +194,7 @@ public class Vala.Delegate : TypeSymbol {
// method is allowed to accept arguments of looser types (weaker precondition)
var method_param = method_params_it.get ();
- if (!param.parameter_type.get_actual_type (dt, null, this).stricter (method_param.parameter_type)) {
+ if (!param.variable_type.get_actual_type (dt, null, this).stricter (method_param.variable_type)) {
return false;
}
}
@@ -355,7 +355,7 @@ public class Vala.Delegate : TypeSymbol {
}
if (param.direction == ParameterDirection.IN) {
- if (param.parameter_type.value_owned) {
+ if (param.variable_type.value_owned) {
str += "owned ";
}
} else {
@@ -364,12 +364,12 @@ public class Vala.Delegate : TypeSymbol {
} else if (param.direction == ParameterDirection.OUT) {
str += "out ";
}
- if (!param.parameter_type.value_owned && param.parameter_type is ReferenceType) {
+ if (!param.variable_type.value_owned && param.variable_type is ReferenceType) {
str += "weak ";
}
}
- str += param.parameter_type.to_string ();
+ str += param.variable_type.to_string ();
i++;
}
diff --git a/vala/valafield.vala b/vala/valafield.vala
index 85029d2..07281f2 100644
--- a/vala/valafield.vala
+++ b/vala/valafield.vala
@@ -25,31 +25,7 @@ using GLib;
/**
* Represents a type or namespace field.
*/
-public class Vala.Field : Symbol, Lockable {
- /**
- * The data type of this field.
- */
- public DataType field_type {
- get { return _data_type; }
- set {
- _data_type = value;
- _data_type.parent_node = this;
- }
- }
-
- /**
- * Specifies the expression to be used to initialize this field.
- */
- public Expression? initializer {
- get { return _initializer; }
- set {
- _initializer = value;
- if (_initializer != null) {
- _initializer.parent_node = this;
- }
- }
- }
-
+public class Vala.Field : Variable, Lockable {
/**
* Specifies whether this field may only be accessed with an instance of
* the contained type.
@@ -106,10 +82,6 @@ public class Vala.Field : Symbol, Lockable {
private bool lock_used = false;
- private Expression _initializer;
-
- private DataType _data_type;
-
/**
* Creates a new field.
*
@@ -119,10 +91,8 @@ public class Vala.Field : Symbol, Lockable {
* @param source reference to source code
* @return newly created field
*/
- public Field (string name, DataType field_type, Expression? initializer, SourceReference? source_reference = null, Comment? comment = null) {
- base (name, source_reference, comment);
- this.field_type = field_type;
- this.initializer = initializer;
+ public Field (string name, DataType variable_type, Expression? initializer, SourceReference? source_reference = null, Comment? comment = null) {
+ base (variable_type, name, initializer, source_reference, comment);
}
public override void accept (CodeVisitor visitor) {
@@ -130,7 +100,7 @@ public class Vala.Field : Symbol, Lockable {
}
public override void accept_children (CodeVisitor visitor) {
- field_type.accept (visitor);
+ variable_type.accept (visitor);
if (initializer != null) {
initializer.accept (visitor);
@@ -268,8 +238,8 @@ public class Vala.Field : Symbol, Lockable {
}
public override void replace_type (DataType old_type, DataType new_type) {
- if (field_type == old_type) {
- field_type = new_type;
+ if (variable_type == old_type) {
+ variable_type = new_type;
}
}
@@ -305,19 +275,19 @@ public class Vala.Field : Symbol, Lockable {
}
analyzer.current_symbol = this;
- field_type.check (analyzer);
+ variable_type.check (analyzer);
// check whether field type is at least as accessible as the field
- if (!analyzer.is_type_accessible (this, field_type)) {
+ if (!analyzer.is_type_accessible (this, variable_type)) {
error = true;
- Report.error (source_reference, "field type `%s` is less accessible than field `%s`".printf (field_type.to_string (), get_full_name ()));
+ Report.error (source_reference, "field type `%s` is less accessible than field `%s`".printf (variable_type.to_string (), get_full_name ()));
return false;
}
process_attributes ();
if (initializer != null) {
- initializer.target_type = field_type;
+ initializer.target_type = variable_type;
if (!initializer.check (analyzer)) {
error = true;
@@ -330,9 +300,9 @@ public class Vala.Field : Symbol, Lockable {
return false;
}
- if (!initializer.value_type.compatible (field_type)) {
+ if (!initializer.value_type.compatible (variable_type)) {
error = true;
- Report.error (source_reference, "Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), field_type.to_string ()));
+ Report.error (source_reference, "Cannot convert from `%s' to `%s'".printf (initializer.value_type.to_string (), variable_type.to_string ()));
return false;
}
diff --git a/vala/valaformalparameter.vala b/vala/valaformalparameter.vala
index e01ad49..605af03 100644
--- a/vala/valaformalparameter.vala
+++ b/vala/valaformalparameter.vala
@@ -27,18 +27,7 @@ using GLib;
/**
* Represents a formal parameter in method and callback signatures.
*/
-public class Vala.FormalParameter : Symbol {
- /**
- * The parameter type.
- */
- public DataType parameter_type {
- get { return _data_type; }
- set {
- _data_type = value;
- _data_type.parent_node = this;
- }
- }
-
+public class Vala.FormalParameter : Variable {
public ParameterDirection direction { get; set; default = ParameterDirection.IN; }
/**
@@ -54,20 +43,6 @@ public class Vala.FormalParameter : Symbol {
public bool params_array { get; set; }
/**
- * Specifies the expression used when the caller doesn't supply an
- * argument for this parameter.
- */
- public Expression? default_expression {
- get { return _default_expression; }
- set {
- _default_expression = value;
- if (_default_expression != null) {
- _default_expression.parent_node = this;
- }
- }
- }
-
- /**
* Specifies whether the array length should be passed implicitly
* if the parameter type is an array.
*/
@@ -109,9 +84,6 @@ public class Vala.FormalParameter : Symbol {
public bool captured { get; set; }
- private DataType _data_type;
- private Expression? _default_expression;
-
/**
* Creates a new formal parameter.
*
@@ -120,9 +92,8 @@ public class Vala.FormalParameter : Symbol {
* @param source reference to source code
* @return newly created formal parameter
*/
- public FormalParameter (string name, DataType parameter_type, SourceReference? source_reference = null) {
- base (name, source_reference);
- this.parameter_type = parameter_type;
+ public FormalParameter (string name, DataType variable_type, SourceReference? source_reference = null) {
+ base (variable_type, name, null, source_reference);
access = SymbolAccessibility.PUBLIC;
}
@@ -132,7 +103,7 @@ public class Vala.FormalParameter : Symbol {
* parameters.
*/
public FormalParameter.with_ellipsis (SourceReference? source_reference = null) {
- base (null, source_reference);
+ base (null, null, null, source_reference);
ellipsis = true;
access = SymbolAccessibility.PUBLIC;
@@ -144,23 +115,23 @@ public class Vala.FormalParameter : Symbol {
public override void accept_children (CodeVisitor visitor) {
if (!ellipsis) {
- parameter_type.accept (visitor);
+ variable_type.accept (visitor);
- if (default_expression != null) {
- default_expression.accept (visitor);
+ if (initializer != null) {
+ initializer.accept (visitor);
}
}
}
public override void replace_type (DataType old_type, DataType new_type) {
- if (parameter_type == old_type) {
- parameter_type = new_type;
+ if (variable_type == old_type) {
+ variable_type = new_type;
}
}
public override void replace_expression (Expression old_node, Expression new_node) {
- if (default_expression == old_node) {
- default_expression = new_node;
+ if (initializer == old_node) {
+ initializer = new_node;
}
}
@@ -204,10 +175,10 @@ public class Vala.FormalParameter : Symbol {
public FormalParameter copy () {
if (!ellipsis) {
- var result = new FormalParameter (name, parameter_type, source_reference);
+ var result = new FormalParameter (name, variable_type, source_reference);
result.params_array = params_array;
result.direction = this.direction;
- result.default_expression = this.default_expression;
+ result.initializer = this.initializer;
return result;
} else {
return new FormalParameter.with_ellipsis ();
@@ -231,37 +202,37 @@ public class Vala.FormalParameter : Symbol {
}
analyzer.current_symbol = parent_symbol;
- if (parameter_type != null) {
- parameter_type.check (analyzer);
+ if (variable_type != null) {
+ variable_type.check (analyzer);
}
if (!ellipsis) {
- parameter_type.check (analyzer);
+ variable_type.check (analyzer);
- if (params_array && !(parameter_type is ArrayType)) {
+ if (params_array && !(variable_type is ArrayType)) {
error = true;
Report.error (source_reference, "parameter array expected");
return false;
}
- if (default_expression != null) {
- default_expression.check (analyzer);
+ if (initializer != null) {
+ initializer.check (analyzer);
}
}
- if (default_expression != null) {
- if (default_expression is NullLiteral
- && !parameter_type.nullable
+ if (initializer != null) {
+ if (initializer is NullLiteral
+ && !variable_type.nullable
&& direction != ParameterDirection.OUT) {
- Report.warning (source_reference, "`null' incompatible with parameter type `%s`".printf (parameter_type.to_string ()));
+ Report.warning (source_reference, "`null' incompatible with parameter type `%s`".printf (variable_type.to_string ()));
}
}
if (!ellipsis) {
// check whether parameter type is at least as accessible as the method
- if (!analyzer.is_type_accessible (this, parameter_type)) {
+ if (!analyzer.is_type_accessible (this, variable_type)) {
error = true;
- Report.error (source_reference, "parameter type `%s` is less accessible than method `%s`".printf (parameter_type.to_string (), parent_symbol.get_full_name ()));
+ Report.error (source_reference, "parameter type `%s` is less accessible than method `%s`".printf (variable_type.to_string (), parent_symbol.get_full_name ()));
}
}
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 50e6e7d..20e2263 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -3041,7 +3041,7 @@ public class Vala.Genie.Parser : CodeVisitor {
}
if (accept (TokenType.ASSIGN)) {
- prop.default_expression = parse_expression ();
+ prop.initializer = parse_expression ();
}
@@ -3123,8 +3123,8 @@ public class Vala.Genie.Parser : CodeVisitor {
if (needs_var) {
/* automatic property accessor body generation */
- var field_type = prop.property_type.copy ();
- prop.field = new Field ("_%s".printf (prop.name), field_type, prop.default_expression, prop.source_reference);
+ var variable_type = prop.property_type.copy ();
+ prop.field = new Field ("_%s".printf (prop.name), variable_type, prop.initializer, prop.source_reference);
prop.field.access = SymbolAccessibility.PRIVATE;
prop.field.binding = prop.binding;
}
@@ -3578,7 +3578,7 @@ public class Vala.Genie.Parser : CodeVisitor {
param.direction = direction;
param.params_array = params_array;
if (accept (TokenType.ASSIGN)) {
- param.default_expression = parse_expression ();
+ param.initializer = parse_expression ();
}
return param;
}
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 67f8437..4726858 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -1124,7 +1124,7 @@ public class Vala.GirParser : CodeVisitor {
}
info.param.carray_length_parameter_position = parameters[info.array_length_idx-add].vala_idx;
}
- if (info.param.parameter_type is ArrayType && info.array_length_idx == -1) {
+ if (info.param.variable_type is ArrayType && info.array_length_idx == -1) {
info.param.no_array_length = true;
}
diff --git a/vala/valainitializerlist.vala b/vala/valainitializerlist.vala
index 927f5ce..c415ff2 100644
--- a/vala/valainitializerlist.vala
+++ b/vala/valainitializerlist.vala
@@ -159,7 +159,7 @@ public class Vala.InitializerList : Expression {
}
}
- e.target_type = field.field_type.copy ();
+ e.target_type = field.variable_type.copy ();
if (!target_type.value_owned) {
e.target_type.value_owned = false;
}
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index 2c5d0a6..34130d4 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -187,7 +187,7 @@ public class Vala.LambdaExpression : Expression {
}
string lambda_param = lambda_param_it.get ();
- var param_type = cb_param.parameter_type.get_actual_type (target_type, null, this);
+ var param_type = cb_param.variable_type.get_actual_type (target_type, null, this);
var param = new FormalParameter (lambda_param, param_type);
method.add_parameter (param);
}
diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala
index f252cee..5ef1107 100644
--- a/vala/valalocalvariable.vala
+++ b/vala/valalocalvariable.vala
@@ -25,35 +25,7 @@ using GLib;
/**
* Represents a local variable declaration in the source code.
*/
-public class Vala.LocalVariable : Symbol {
- /**
- * The optional initializer expression.
- */
- public Expression? initializer {
- get {
- return _initializer;
- }
- set {
- _initializer = value;
- if (_initializer != null) {
- _initializer.parent_node = this;
- }
- }
- }
-
- /**
- * The variable type.
- */
- public DataType? variable_type {
- get { return _variable_type; }
- set {
- _variable_type = value;
- if (_variable_type != null) {
- _variable_type.parent_node = this;
- }
- }
- }
-
+public class Vala.LocalVariable : Variable {
public bool is_result { get; set; }
/**
@@ -65,9 +37,6 @@ public class Vala.LocalVariable : Symbol {
public bool no_init { get; set; }
- private Expression? _initializer;
- private DataType? _variable_type;
-
/**
* Creates a new local variable.
*
@@ -77,9 +46,7 @@ public class Vala.LocalVariable : Symbol {
* @return newly created variable declarator
*/
public LocalVariable (DataType? variable_type, string name, Expression? initializer = null, SourceReference? source_reference = null) {
- base (name, source_reference);
- this.variable_type = variable_type;
- this.initializer = initializer;
+ base (variable_type, name, initializer, source_reference);
}
public override void accept (CodeVisitor visitor) {
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index b6325f2..bc9717f 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -521,7 +521,7 @@ public class Vala.MemberAccess : Expression {
// do not allow access to fields of generic types
// if instance type does not specify type arguments
- if (f.field_type is GenericType) {
+ if (f.variable_type is GenericType) {
generics = true;
}
} else if (member is Method) {
@@ -574,7 +574,7 @@ public class Vala.MemberAccess : Expression {
// do not allow access to methods using generic type parameters
// if instance type does not specify type arguments
foreach (var param in m.get_parameters ()) {
- var generic_type = param.parameter_type as GenericType;
+ var generic_type = param.variable_type as GenericType;
if (generic_type != null && generic_type.type_parameter.parent_symbol is TypeSymbol) {
generics = true;
break;
@@ -724,7 +724,7 @@ public class Vala.MemberAccess : Expression {
// implicit this access
if (instance && inner == null) {
inner = new MemberAccess (null, "this", source_reference);
- inner.value_type = this_parameter.parameter_type.copy ();
+ inner.value_type = this_parameter.variable_type.copy ();
inner.symbol_reference = this_parameter;
}
diff --git a/vala/valamethod.vala b/vala/valamethod.vala
index 8b36106..5119c03 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -545,8 +545,8 @@ public class Vala.Method : Symbol {
return false;
}
- actual_base_type = base_param.parameter_type.get_actual_type (object_type, null, this);
- if (!actual_base_type.equals (method_params_it.get ().parameter_type)) {
+ actual_base_type = base_param.variable_type.get_actual_type (object_type, null, this);
+ if (!actual_base_type.equals (method_params_it.get ().variable_type)) {
invalid_match = "incompatible type of parameter %d".printf (param_index);
return false;
}
@@ -996,12 +996,12 @@ public class Vala.Method : Symbol {
return false;
}
- if (!(param.parameter_type is ArrayType)) {
+ if (!(param.variable_type is ArrayType)) {
// parameter must be an array
return false;
}
- var array_type = (ArrayType) param.parameter_type;
+ var array_type = (ArrayType) param.variable_type;
if (array_type.element_type.data_type != analyzer.string_type.data_type) {
// parameter must be an array of strings
return false;
@@ -1013,7 +1013,7 @@ public class Vala.Method : Symbol {
public int get_required_arguments () {
int n = 0;
foreach (var param in parameters) {
- if (param.default_expression != null || param.ellipsis) {
+ if (param.initializer != null || param.ellipsis) {
// optional argument
break;
}
@@ -1056,7 +1056,7 @@ public class Vala.Method : Symbol {
callback_type.is_called_once = true;
var callback_param = new FormalParameter ("_callback_", callback_type);
- callback_param.default_expression = new NullLiteral (source_reference);
+ callback_param.initializer = new NullLiteral (source_reference);
callback_param.cparameter_position = -1;
callback_param.cdelegate_target_parameter_position = -0.9;
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index 4da68f7..af41a66 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -323,7 +323,7 @@ public class Vala.MethodCall : Expression {
}
if (param.params_array) {
- var array_type = (ArrayType) param.parameter_type;
+ var array_type = (ArrayType) param.variable_type;
while (arg_it.next ()) {
Expression arg = arg_it.get ();
@@ -338,7 +338,7 @@ public class Vala.MethodCall : Expression {
Expression arg = arg_it.get ();
/* store expected type for callback parameters */
- arg.formal_target_type = param.parameter_type;
+ arg.formal_target_type = param.variable_type;
arg.target_type = arg.formal_target_type.get_actual_type (target_object_type, call as MemberAccess, this);
last_arg = arg;
@@ -587,7 +587,7 @@ public class Vala.MethodCall : Expression {
if (arg_it.next ()) {
Expression arg = arg_it.get ();
- var generic_type = param.parameter_type as GenericType;
+ var generic_type = param.variable_type as GenericType;
if (generic_type != null && generic_type.type_parameter == type_param) {
type_arg = arg.value_type.copy ();
type_arg.value_owned = true;
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 8e334fe..1a3ecc7 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -333,7 +333,7 @@ public class Vala.ObjectCreationExpression : Expression {
Expression arg = arg_it.get ();
/* store expected type for callback parameters */
- arg.formal_target_type = param.parameter_type;
+ arg.formal_target_type = param.variable_type;
arg.target_type = arg.formal_target_type.get_actual_type (value_type, null, this);
}
}
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 2acbcee..9161da2 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2739,11 +2739,11 @@ public class Vala.Parser : CodeVisitor {
expect (TokenType.OPEN_BRACE);
while (current () != TokenType.CLOSE_BRACE) {
if (accept (TokenType.DEFAULT)) {
- if (prop.default_expression != null) {
+ if (prop.initializer != null) {
throw new ParseError.SYNTAX (get_error ("property default value already defined"));
}
expect (TokenType.ASSIGN);
- prop.default_expression = parse_expression ();
+ prop.initializer = parse_expression ();
expect (TokenType.SEMICOLON);
} else {
var accessor_begin = get_location ();
@@ -2812,12 +2812,12 @@ public class Vala.Parser : CodeVisitor {
if (empty_get && empty_set) {
/* automatic property accessor body generation */
- var field_type = prop.property_type.copy ();
- prop.field = new Field ("_%s".printf (prop.name), field_type, prop.default_expression, prop.source_reference);
+ var variable_type = prop.property_type.copy ();
+ prop.field = new Field ("_%s".printf (prop.name), variable_type, prop.initializer, prop.source_reference);
prop.field.access = SymbolAccessibility.PRIVATE;
prop.field.binding = prop.binding;
- } else if (prop.default_expression != null) {
- Report.error (prop.default_expression.source_reference, "only automatic properties can have default values");
+ } else if (prop.initializer != null) {
+ Report.error (prop.initializer.source_reference, "only automatic properties can have default values");
}
}
@@ -3279,7 +3279,7 @@ public class Vala.Parser : CodeVisitor {
param.direction = direction;
param.params_array = params_array;
if (accept (TokenType.ASSIGN)) {
- param.default_expression = parse_expression ();
+ param.initializer = parse_expression ();
}
return param;
}
diff --git a/vala/valaproperty.vala b/vala/valaproperty.vala
index 4f31ae2..7621099 100644
--- a/vala/valaproperty.vala
+++ b/vala/valaproperty.vala
@@ -144,7 +144,7 @@ public class Vala.Property : Symbol, Lockable {
/**
* Specifies the default value of this property.
*/
- public Expression default_expression { get; set; }
+ public Expression initializer { get; set; }
public bool no_array_length { get; set; }
@@ -220,8 +220,8 @@ public class Vala.Property : Symbol, Lockable {
set_accessor.accept (visitor);
}
- if (default_expression != null) {
- default_expression.accept (visitor);
+ if (initializer != null) {
+ initializer.accept (visitor);
}
}
@@ -487,8 +487,8 @@ public class Vala.Property : Symbol, Lockable {
set_accessor.check (analyzer);
}
- if (default_expression != null) {
- default_expression.check (analyzer);
+ if (initializer != null) {
+ initializer.check (analyzer);
}
// check whether property type is at least as accessible as the property
@@ -513,9 +513,9 @@ public class Vala.Property : Symbol, Lockable {
}
}
- if (default_expression != null && !default_expression.error && default_expression.value_type != null && !(default_expression.value_type.compatible (property_type))) {
+ if (initializer != null && !initializer.error && initializer.value_type != null && !(initializer.value_type.compatible (property_type))) {
error = true;
- Report.error (default_expression.source_reference, "Expected initializer of type `%s' but got `%s'".printf (property_type.to_string (), default_expression.value_type.to_string ()));
+ Report.error (initializer.source_reference, "Expected initializer of type `%s' but got `%s'".printf (property_type.to_string (), initializer.value_type.to_string ()));
}
analyzer.current_source_file = old_source_file;
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 4a6ab87..8226aed 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -256,7 +256,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
public DataType? get_value_type_for_symbol (Symbol sym, bool lvalue) {
if (sym is Field) {
var f = (Field) sym;
- var type = f.field_type.copy ();
+ var type = f.variable_type.copy ();
if (!lvalue) {
type.value_owned = false;
}
@@ -279,7 +279,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
} else if (sym is FormalParameter) {
var p = (FormalParameter) sym;
- var type = p.parameter_type.copy ();
+ var type = p.variable_type.copy ();
if (!lvalue) {
type.value_owned = false;
}
@@ -417,7 +417,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
}
if (arg_it == null || !arg_it.next ()) {
- if (param.default_expression == null) {
+ if (param.initializer == null) {
expr.error = true;
Report.error (expr.source_reference, "Too few arguments, method `%s' does not take %d arguments".printf (mtype.to_string (), args.size));
return false;
@@ -425,9 +425,9 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
var invocation_expr = expr as MethodCall;
var object_creation_expr = expr as ObjectCreationExpression;
if (invocation_expr != null) {
- invocation_expr.add_argument (param.default_expression);
+ invocation_expr.add_argument (param.initializer);
} else if (object_creation_expr != null) {
- object_creation_expr.add_argument (param.default_expression);
+ object_creation_expr.add_argument (param.initializer);
} else {
assert_not_reached ();
}
@@ -772,7 +772,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
DataType member_type = null;
if (init.symbol_reference is Field) {
var f = (Field) init.symbol_reference;
- member_type = f.field_type;
+ member_type = f.variable_type;
} else if (init.symbol_reference is Property) {
var prop = (Property) init.symbol_reference;
member_type = prop.property_type;
diff --git a/vala/valasignal.vala b/vala/valasignal.vala
index 87d2efe..926c75f 100644
--- a/vala/valasignal.vala
+++ b/vala/valasignal.vala
@@ -139,7 +139,7 @@ public class Vala.Signal : Symbol, Lockable {
foreach (FormalParameter param in parameters) {
var actual_param = param.copy ();
- actual_param.parameter_type = actual_param.parameter_type.get_actual_type (sender_type, null, node_reference);
+ actual_param.variable_type = actual_param.variable_type.get_actual_type (sender_type, null, node_reference);
generated_delegate.add_parameter (actual_param);
}
diff --git a/vala/valastruct.vala b/vala/valastruct.vala
index 180c67e..c05618e 100644
--- a/vala/valastruct.vala
+++ b/vala/valastruct.vala
@@ -745,7 +745,7 @@ public class Vala.Struct : TypeSymbol {
foreach (Field f in fields) {
if (f.binding == MemberBinding.INSTANCE
- && f.field_type.is_disposable ()) {
+ && f.variable_type.is_disposable ()) {
return true;
}
}
@@ -761,7 +761,7 @@ public class Vala.Struct : TypeSymbol {
return true;
}
foreach (Field f in st.fields) {
- if (f.binding == MemberBinding.INSTANCE && is_recursive_value_type (f.field_type)) {
+ if (f.binding == MemberBinding.INSTANCE && is_recursive_value_type (f.variable_type)) {
return true;
}
}
@@ -803,7 +803,7 @@ public class Vala.Struct : TypeSymbol {
foreach (Field f in fields) {
f.check (analyzer);
- if (f.binding == MemberBinding.INSTANCE && is_recursive_value_type (f.field_type)) {
+ if (f.binding == MemberBinding.INSTANCE && is_recursive_value_type (f.variable_type)) {
error = true;
Report.error (f.source_reference, "Recursive value types are not allowed");
return false;
diff --git a/vala/valavariable.vala b/vala/valavariable.vala
new file mode 100644
index 0000000..9337751
--- /dev/null
+++ b/vala/valavariable.vala
@@ -0,0 +1,60 @@
+/* valavariable.vala
+ *
+ * Copyright (C) 2010 Jürg Billeter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Jürg Billeter <j bitron ch>
+ */
+
+public class Vala.Variable : Symbol {
+ /**
+ * The optional initializer expression.
+ */
+ public Expression? initializer {
+ get {
+ return _initializer;
+ }
+ set {
+ _initializer = value;
+ if (_initializer != null) {
+ _initializer.parent_node = this;
+ }
+ }
+ }
+
+ /**
+ * The variable type.
+ */
+ public DataType? variable_type {
+ get { return _variable_type; }
+ set {
+ _variable_type = value;
+ if (_variable_type != null) {
+ _variable_type.parent_node = this;
+ }
+ }
+ }
+
+ Expression? _initializer;
+ DataType? _variable_type;
+
+ public Variable (DataType? variable_type, string? name, Expression? initializer = null, SourceReference? source_reference = null, Comment? comment = null) {
+ base (name, source_reference, comment);
+ this.variable_type = variable_type;
+ this.initializer = initializer;
+ }
+}
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 985665e..8f28562 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -367,7 +367,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (nv[0] == "is_array") {
if (eval (nv[1]) == "1") {
param_type = new ArrayType (param_type, 1, param_type.source_reference);
- p.parameter_type = param_type;
+ p.variable_type = param_type;
if (!out_requested) {
p.direction = ParameterDirection.IN;
}
@@ -380,7 +380,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (!array_requested && param_type is ArrayType) {
var array_type = (ArrayType) param_type;
param_type = array_type.element_type;
- p.parameter_type = param_type;
+ p.variable_type = param_type;
}
}
} else if (nv[0] == "is_ref") {
@@ -389,7 +389,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (!array_requested && param_type is ArrayType) {
var array_type = (ArrayType) param_type;
param_type = array_type.element_type;
- p.parameter_type = param_type;
+ p.variable_type = param_type;
}
}
} else if (nv[0] == "takes_ownership") {
@@ -416,7 +416,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else {
// Overwrite old param_type, so "type_name" must be before any
// other param type modifying metadata
- p.parameter_type = param_type = new UnresolvedType.from_symbol (sym, return_type.source_reference);
+ p.variable_type = param_type = new UnresolvedType.from_symbol (sym, return_type.source_reference);
}
}
}
@@ -1851,7 +1851,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (nv[0] == "is_array") {
if (eval (nv[1]) == "1") {
param_type = new ArrayType (param_type, 1, param_type.source_reference);
- p.parameter_type = param_type;
+ p.variable_type = param_type;
if (!out_requested) {
p.direction = ParameterDirection.IN;
}
@@ -1864,7 +1864,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (!array_requested && param_type is ArrayType) {
var array_type = (ArrayType) param_type;
param_type = array_type.element_type;
- p.parameter_type = param_type;
+ p.variable_type = param_type;
}
}
} else if (nv[0] == "is_ref") {
@@ -1873,7 +1873,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (!array_requested && param_type is ArrayType) {
var array_type = (ArrayType) param_type;
param_type = array_type.element_type;
- p.parameter_type = param_type;
+ p.variable_type = param_type;
}
}
} else if (nv[0] == "nullable") {
@@ -1924,7 +1924,7 @@ public class Vala.GIdlParser : CodeVisitor {
} else {
// Overwrite old param_type, so "type_name" must be before any
// other param type modifying metadata
- p.parameter_type = param_type = new UnresolvedType.from_symbol (sym, return_type.source_reference);
+ p.variable_type = param_type = new UnresolvedType.from_symbol (sym, return_type.source_reference);
}
} else if (nv[0] == "ctype") {
p.ctype = eval (nv[1]);
@@ -1936,30 +1936,30 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (nv[0] == "default_value") {
var val = eval (nv[1]);
if (val == "null") {
- p.default_expression = new NullLiteral (param_type.source_reference);
+ p.initializer = new NullLiteral (param_type.source_reference);
} else if (val == "true") {
- p.default_expression = new BooleanLiteral (true, param_type.source_reference);
+ p.initializer = new BooleanLiteral (true, param_type.source_reference);
} else if (val == "false") {
- p.default_expression = new BooleanLiteral (false, param_type.source_reference);
+ p.initializer = new BooleanLiteral (false, param_type.source_reference);
} else if (val == "") {
- p.default_expression = new StringLiteral ("\"\"", param_type.source_reference);
+ p.initializer = new StringLiteral ("\"\"", param_type.source_reference);
} else {
unowned string endptr;
unowned string val_end = val.offset (val.len ());
val.to_long (out endptr);
if ((long)endptr == (long)val_end) {
- p.default_expression = new IntegerLiteral (val, param_type.source_reference);
+ p.initializer = new IntegerLiteral (val, param_type.source_reference);
} else {
val.to_double (out endptr);
if ((long)endptr == (long)val_end) {
- p.default_expression = new RealLiteral (val, param_type.source_reference);
+ p.initializer = new RealLiteral (val, param_type.source_reference);
} else {
if (val.has_prefix ("\"") && val.has_suffix ("\"")) {
- p.default_expression = new StringLiteral (val, param_type.source_reference);
+ p.initializer = new StringLiteral (val, param_type.source_reference);
} else {
foreach (var member in val.split (".")) {
- p.default_expression = new MemberAccess (p.default_expression, member, param_type.source_reference);
+ p.initializer = new MemberAccess (p.initializer, member, param_type.source_reference);
}
}
}
@@ -1973,7 +1973,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (!(last_param_type is ArrayType)) {
// last_param is array, p is array length
last_param_type = new ArrayType (last_param_type, 1, last_param_type.source_reference);
- last_param.parameter_type = last_param_type;
+ last_param.variable_type = last_param_type;
last_param.direction = ParameterDirection.IN;
}
@@ -2479,7 +2479,7 @@ public class Vala.GIdlParser : CodeVisitor {
if (nv[0] == "is_array") {
if (eval (nv[1]) == "1") {
param_type = new ArrayType (param_type, 1, param_type.source_reference);
- p.parameter_type = param_type;
+ p.variable_type = param_type;
p.direction = ParameterDirection.IN;
}
} else if (nv[0] == "is_out") {
@@ -2501,13 +2501,13 @@ public class Vala.GIdlParser : CodeVisitor {
} else if (nv[0] == "type_name") {
if (!(param_type is UnresolvedType)) {
param_type = new UnresolvedType ();
- p.parameter_type = param_type;
+ p.variable_type = param_type;
}
((UnresolvedType) param_type).unresolved_symbol = new UnresolvedSymbol (null, eval (nv[1]));
} else if (nv[0] == "type_arguments") {
var type_args = eval (nv[1]).split (",");
foreach (string type_arg in type_args) {
- p.parameter_type.add_type_argument (get_type_from_string (type_arg));
+ p.variable_type.add_type_argument (get_type_from_string (type_arg));
}
} else if (nv[0] == "namespace_name") {
ns_name = eval (nv[1]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]