]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Fix abstract and virtual array properties
authorJürg Billeter <j@bitron.ch>
Sun, 14 Jun 2009 14:06:45 +0000 (16:06 +0200)
committerJürg Billeter <j@bitron.ch>
Sun, 14 Jun 2009 14:18:18 +0000 (16:18 +0200)
codegen/valaccodebasemodule.vala
codegen/valagobjectmodule.vala
codegen/valagtypemodule.vala

index c6c5ba9d71d56098917d0447ae11fe1484571466..d52a639d780d1eca84a397032d950d7ef373829e 100644 (file)
@@ -1296,12 +1296,31 @@ internal class Vala.CCodeBaseModule : CCodeModule {
                                        vcall.add_argument (new CCodeIdentifier ("value"));
                                        block.add_statement (new CCodeExpressionStatement (vcall));
                                } else {
+                                       if (acc.value_type is ArrayType) {
+                                               var array_type = (ArrayType) acc.value_type;
+
+                                               for (int dim = 1; dim <= array_type.rank; dim++) {
+                                                       var len_expr = new CCodeIdentifier (head.get_array_length_cname ("result", dim));
+                                                       vcall.add_argument (len_expr);
+                                               }
+                                       }
+
                                        block.add_statement (new CCodeReturnStatement (vcall));
                                }
                        } else {
                                var vcall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (vcast, "set_%s".printf (prop.name)));
                                vcall.add_argument (new CCodeIdentifier ("self"));
                                vcall.add_argument (new CCodeIdentifier ("value"));
+
+                               if (acc.value_type is ArrayType) {
+                                       var array_type = (ArrayType) acc.value_type;
+
+                                       for (int dim = 1; dim <= array_type.rank; dim++) {
+                                               var len_expr = new CCodeIdentifier (head.get_array_length_cname ("value", dim));
+                                               vcall.add_argument (len_expr);
+                                       }
+                               }
+
                                block.add_statement (new CCodeExpressionStatement (vcall));
                        }
 
index dc198e4fa993f6d745714173c2728930f82782c8..6b3e7a190427937b1100e99aeba6e0d4d5c01bd1 100644 (file)
@@ -144,6 +144,10 @@ internal class Vala.GObjectModule : GTypeModule {
                                continue;
                        }
 
+                       if (prop.property_type is ArrayType) {
+                               continue;
+                       }
+
                        if (prop.overrides || prop.base_interface_property != null) {
                                var cinst = new CCodeFunctionCall (new CCodeIdentifier ("g_object_class_override_property"));
                                cinst.add_argument (ccall);
@@ -215,6 +219,10 @@ internal class Vala.GObjectModule : GTypeModule {
                                continue;
                        }
 
+                       if (prop.property_type is ArrayType) {
+                               continue;
+                       }
+
                        string prefix = cl.get_lower_case_cname (null);
                        CCodeExpression cself = new CCodeIdentifier ("self");
                        if (prop.base_property != null) {
@@ -295,6 +303,10 @@ internal class Vala.GObjectModule : GTypeModule {
                                continue;
                        }
 
+                       if (prop.property_type is ArrayType) {
+                               continue;
+                       }
+
                        string prefix = cl.get_lower_case_cname (null);
                        CCodeExpression cself = new CCodeIdentifier ("self");
                        if (prop.base_property != null) {
index 468f3531518fc42d7c4a862b6781d3c430a35f96..a38954cf884d6c6f666e87e680db15ce4663e1af 100644 (file)
@@ -235,6 +235,14 @@ internal class Vala.GTypeModule : GErrorModule {
                                } else {
                                        creturn_type = prop.property_type.get_cname ();
                                }
+
+                               var array_type = prop.property_type as ArrayType;
+                               if (array_type != null) {
+                                       for (int dim = 1; dim <= array_type.rank; dim++) {
+                                               vdeclarator.add_parameter (new CCodeFormalParameter (head.get_array_length_cname ("result", dim), "int*"));
+                                       }
+                               }
+
                                var vdecl = new CCodeDeclaration (creturn_type);
                                vdecl.add_declarator (vdeclarator);
                                type_struct.add_declaration (vdecl);
@@ -243,6 +251,14 @@ internal class Vala.GTypeModule : GErrorModule {
                                var vdeclarator = new CCodeFunctionDeclarator ("set_%s".printf (prop.name));
                                vdeclarator.add_parameter (cselfparam);
                                vdeclarator.add_parameter (cvalueparam);
+
+                               var array_type = prop.property_type as ArrayType;
+                               if (array_type != null) {
+                                       for (int dim = 1; dim <= array_type.rank; dim++) {
+                                               vdeclarator.add_parameter (new CCodeFormalParameter (head.get_array_length_cname ("value", dim), "int"));
+                                       }
+                               }
+
                                var vdecl = new CCodeDeclaration ("void");
                                vdecl.add_declarator (vdeclarator);
                                type_struct.add_declaration (vdecl);
@@ -1692,6 +1708,14 @@ internal class Vala.GTypeModule : GErrorModule {
                                } else {
                                        creturn_type = prop.get_accessor.value_type.get_cname ();
                                }
+
+                               var array_type = prop.property_type as ArrayType;
+                               if (array_type != null) {
+                                       for (int dim = 1; dim <= array_type.rank; dim++) {
+                                               vdeclarator.add_parameter (new CCodeFormalParameter (head.get_array_length_cname ("result", dim), "int*"));
+                                       }
+                               }
+
                                var vdecl = new CCodeDeclaration (creturn_type);
                                vdecl.add_declarator (vdeclarator);
                                type_struct.add_declaration (vdecl);
@@ -1706,6 +1730,14 @@ internal class Vala.GTypeModule : GErrorModule {
                                        var cvalueparam = new CCodeFormalParameter ("value", prop.set_accessor.value_type.get_cname ());
                                        vdeclarator.add_parameter (cvalueparam);
                                }
+
+                               var array_type = prop.property_type as ArrayType;
+                               if (array_type != null) {
+                                       for (int dim = 1; dim <= array_type.rank; dim++) {
+                                               vdeclarator.add_parameter (new CCodeFormalParameter (head.get_array_length_cname ("value", dim), "int"));
+                                       }
+                               }
+
                                var vdecl = new CCodeDeclaration ("void");
                                vdecl.add_declarator (vdeclarator);
                                type_struct.add_declaration (vdecl);
@@ -1767,6 +1799,11 @@ internal class Vala.GTypeModule : GErrorModule {
                        var props = iface.get_properties ();
                        foreach (Property prop in props) {
                                if (prop.is_abstract) {
+
+                                       if (prop.property_type is ArrayType) {
+                                               continue;
+                                       }
+
                                        var cinst = new CCodeFunctionCall (new CCodeIdentifier ("g_object_interface_install_property"));
                                        cinst.add_argument (new CCodeIdentifier ("iface"));
                                        cinst.add_argument (head.get_param_spec (prop));