]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add Variable class
authorJürg Billeter <j@bitron.ch>
Sun, 25 Jul 2010 19:05:31 +0000 (21:05 +0200)
committerJürg Billeter <j@bitron.ch>
Tue, 27 Jul 2010 13:47:02 +0000 (15:47 +0200)
48 files changed:
codegen/valaccodearraymodule.vala
codegen/valaccodebasemodule.vala
codegen/valaccodedelegatemodule.vala
codegen/valaccodememberaccessmodule.vala
codegen/valaccodemethodcallmodule.vala
codegen/valaccodemethodmodule.vala
codegen/valaccodestructmodule.vala
codegen/valadbusclientmodule.vala
codegen/valadbusmodule.vala
codegen/valadbusservermodule.vala
codegen/valadovabasemodule.vala
codegen/valadovadelegatemodule.vala
codegen/valadovamemberaccessmodule.vala
codegen/valadovamethodcallmodule.vala
codegen/valadovaobjectmodule.vala
codegen/valadovastructmodule.vala
codegen/valadovavaluemodule.vala
codegen/valagasyncmodule.vala
codegen/valagdbusclientmodule.vala
codegen/valagdbusservermodule.vala
codegen/valagirwriter.vala
codegen/valagsignalmodule.vala
codegen/valagtypemodule.vala
codegen/valagvariantmodule.vala
vala/Makefile.am
vala/valaarraytype.vala
vala/valaassignment.vala
vala/valaclass.vala
vala/valacodewriter.vala
vala/valadelegate.vala
vala/valafield.vala
vala/valaformalparameter.vala
vala/valagenieparser.vala
vala/valagirparser.vala
vala/valainitializerlist.vala
vala/valalambdaexpression.vala
vala/valalocalvariable.vala
vala/valamemberaccess.vala
vala/valamethod.vala
vala/valamethodcall.vala
vala/valaobjectcreationexpression.vala
vala/valaparser.vala
vala/valaproperty.vala
vala/valasemanticanalyzer.vala
vala/valasignal.vala
vala/valastruct.vala
vala/valavariable.vala [new file with mode: 0644]
vapigen/valagidlparser.vala

index f2ad1ede5cc5241ed566fb3115c0d0c91278f2e4..bec474c5b89beec3fefcd377ae08c3edef406b96 100644 (file)
@@ -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);
 
index 677f4ffc80ea6b6464d947f13384bd87612bdbe0..56e9911501e4c66519c5dbf942442725d900fd4d 100644 (file)
@@ -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");
index 3b21bba2b3d1fc63259043dcfc6f5615f0c9b65c..706d8bfc89606909e0ccbd2c50cc3379f0fc6d10 100644 (file)
@@ -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) {
index 57ddcd3f22d8f7e1494925a579cfe2c5a5949050..52ea34daf88d3ce8597040038aa5feaf46512b72 100644 (file)
@@ -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
index 85816eeeba115d97b612b15f9ec012bddfa630ef..2f2306bac33366f6618ee74f02d31aa649286cb7 100644 (file)
@@ -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));
index aa786a5ebdf252ac2bfd3c22d1e82acc4235467b..a07ac05b92479a9416c98ecb0f933792d85cda4a 100644 (file)
@@ -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 += "*";
                                        }
                                }
index 4b3587ab345aa716f4f7fbdd86af7cbf6b7102f9..16aaf145bdd7e3d933c438274b50158d91fc1629 100644 (file)
@@ -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");
index 9e02444df2e22523739e909f33022972a9a60131..cb9ff5d5f40bcb6a385a8cb7e0a353022e512b6d 100644 (file)
@@ -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);
                        }
                }
 
index 1ee94d432b6dfecbc0d87ab1b394a8386a6bf141..65ce9b03d05e74ae17ea5da2a150e5b7b074f02e 100644 (file)
@@ -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"));
index 399a1cc4f4dcb6f5106234f3725636ccbb0f4278..54f6474dcca776aca02c5b322b1ce61e2886ca16 100644 (file)
@@ -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";
index 915448fe9b7fe64befaa086ceb2d86fc409e889d..14d0ee18d93e4fa6bc8eb799c09acffc5893f5a8 100644 (file)
@@ -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;
        }
index 6be32ecbfdbc02b426613f8f3b7c96bfc39bca1f..9e361c43ce657e72e432a3c2c8804a6cce790c7c 100644 (file)
@@ -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) {
index c6ef7e46f402f98c4b371bfef5f6151ad4830813..3785932bba73e7eec03b617e2fc0ec8f602d2663 100644 (file)
@@ -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)));
index 149bc89a22e87f4889f4b33cc528a8396cb83fbf..ed4d571339269ae80d9d4177b952c9a8afabd9a7 100644 (file)
@@ -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));
index 44e07cecf2993d106591808b841b95e5f0a9ed4b..cf700faf31db6be999a42256af7e14916ca95d0a 100644 (file)
@@ -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 += "*";
                                }
 
index 1497a3a4d6822afe50cb4d83bfff34d270f31d3a..fa01e502ab7402ea1661d21adae2927710442a19 100644 (file)
@@ -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 ());
                        }
                }
 
index fb3907f31dc6dea7be249f05606344cade6c9983..ba9d2116eddc966178ccc90cce48d004300cbe3b 100644 (file)
@@ -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)));
index ebb142ed6f301e9d573cb23efcc6c2ddd08cf78e..c406b4b74641acbdb7f5ffa366a5a7ae3c6302ef 100644 (file)
@@ -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"))));
                                }
                        }
index 1113df6d5635614627cb88a05dff6b414901bdf6..cd4a0ff02cb5a18b25649ca7d951cd306a5efe7d 100644 (file)
@@ -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
index 1864a1a98a50fbd843721456c6eb8b26abcfc3f5..2680a86815c1a0fe4ed97f0c93d94acaeb0f8082 100644 (file)
@@ -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));
index 601583c86d7a02247ffc5f93594185dc5c4178d4..e1899deec58061583eb6874cbe29095143410ab1 100644 (file)
@@ -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;
index 4b17a81b03ead9586b9755dc304ed7810042702e..d62b30d8d514715a3a6314562451815bdc6eec63 100644 (file)
@@ -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;
        }
index 50c7cdcde1c9af244bc2d8abf558ac078875b15c..e2a001e0f0e4d17cc920defdfc355706a1d9dc68 100644 (file)
@@ -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"));
                                }
index 0694edf57a7db94ca3bcc489ff6194a216522c48..e44c49539ac9153a8d2293d5de356da041652fdd 100644 (file)
@@ -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) {
index 1dc0ca857b5de9c8d5f9cace35f4198d741054e2..7148e44feb150031555d4dbd0cf16cc4cb916980 100644 (file)
@@ -156,6 +156,7 @@ libvalacore_la_VALASOURCES = \
        valaunresolvedtype.vala \
        valausingdirective.vala \
        valavaluetype.vala \
+       valavariable.vala \
        valavoidtype.vala \
        valawhilestatement.vala \
        valayieldstatement.vala \
index c1d9e0e04c329d9f1a6a52f19d392ffc9868c74a..ee57df57d034afa48d5f58f24f25e0077d150d7a 100644 (file)
@@ -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"));
                        }
 
                }
index 7cb5b1f2520529f4211d924c9dfb7228594d64c7..66c93165a7063e22965f735c644b50da2d1f2d16 100644 (file)
@@ -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");
index fb0ce37cccddaf92047120c5738c3024bb5885d4..1fb579833ae6d810c29a6b0611ea21028efdeb7d 100644 (file)
@@ -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 ();
index e72545885a8a04b14642c314b5aa0840b719967e..89d848fdc579eac9ac774929790ba7d5857581d1 100644 (file)
@@ -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++;
index 85ada07ccb3dd85892a059fdfdb3c462e57f2fb1..27c660ccceb07b10ddbb3f2d9a774f29a1030158 100644 (file)
@@ -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++;
                }
index 85029d23b6b34cff930ba4a5d450ff0ecc7cd09b..07281f24683b0e4faa53cd19cfe96769dbc8129e 100644 (file)
@@ -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;
                        }
 
index e01ad49faf7798165e6c498cb856d49a866f5d95..605af0349dfc1729197de52498318abb8bb2cd28 100644 (file)
@@ -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; }
 
        /**
@@ -53,20 +42,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 ()));
                        }
                }
 
index 50e6e7d37aeec66392693bddc98e3a9172dc1ac4..20e2263cc45fa542e66dce01e3d090aacd378845 100644 (file)
@@ -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;
        }
index 67f8437f542dd1ea93dd4e469d28c557065b015b..47268583f28e2f5f97ee2e5b174b7f92fb132526 100644 (file)
@@ -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;
                                }
 
index 927f5cee2847c7c59756c8dd022b48021d56f9e5..c415ff2182f16450989f3219ca5099d1e12b1b5b 100644 (file)
@@ -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;
                                }
index 2c5d0a69c4fbf8d4e609a65b69378c5f3824b629..34130d47bea35cb5211ce528d54603a34d496a05 100644 (file)
@@ -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);
                }
index f252ceeac9ff68e35084e2559da7b6a542ffc857..5ef1107fba7a4b81a084dadd5604fd0849eb482e 100644 (file)
@@ -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) {
index b6325f222349ae70710decde8213ba09759d6481..bc9717ff0ff3f77ded631f8c97e90d7754f31de5 100644 (file)
@@ -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;
                        }
 
index 8b361066db26ae375d14b2b6df44c8b3378db44e..5119c03c742cf30d2eee2cc3c922097eeb904b57 100644 (file)
@@ -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;
 
index 4da68f7e87d035ae3abd47c7b6a795c50816ed8c..af41a66a73951607655f66e5183a28963be0b7b0 100644 (file)
@@ -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;
index 8e334fe478ff51dff7b6be173307753d286b24e2..1a3ecc79b2e37e9032035b4ff30cd68732fd75bb 100644 (file)
@@ -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);
                                }
                        }
index 2acbceef4c6ea6ea3250ee2fc7c58b4ce8c3058f..9161da2f72551d2838ae3ad68c04e2b8603caf5c 100644 (file)
@@ -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;
        }
index 4f31ae28417c867376d487a6de09684f871c300f..7621099c768d5419fdbe4e4b4da274ee3de7a7b2 100644 (file)
@@ -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;
index 4a6ab876555fab21ddbe72c03d3e11743ca53d10..8226aed188285a63aad34a56df2a8c4eaa31ef05 100644 (file)
@@ -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;
index 87d2efe29913c45a614a7609c3d63cebafc937ca..926c75fbbd754f84a91127648aecf917bf9ad029 100644 (file)
@@ -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);
                }
 
index 180c67e65d82005916f9af66c7f2c7b87e94daf6..c05618e3d468c4283bdd830a3cb3392e7abce503 100644 (file)
@@ -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 (file)
index 0000000..9337751
--- /dev/null
@@ -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;
+       }
+}
index 985665e205dfab8bd6fd891013061669980e6acf..8f28562ced0801b3a09f057faac8e1303555c2e9 100644 (file)
@@ -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]);