]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
dova: Improve support for any class
authorJürg Billeter <j@bitron.ch>
Sun, 18 Jul 2010 14:28:49 +0000 (16:28 +0200)
committerJürg Billeter <j@bitron.ch>
Sun, 18 Jul 2010 14:28:49 +0000 (16:28 +0200)
codegen/valadovaobjectmodule.vala
codegen/valadovavaluemodule.vala

index 817555e5c4d331a16bfc690ae745ad471024b96c..1db3c62972cb067c30794b4b5dd2d8d9a530ef16 100644 (file)
@@ -170,7 +170,7 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
                        instance_priv_struct.add_declaration (vdecl);
 
                        vdeclarator = new CCodeFunctionDeclarator ("value_from_any");
-                       vdeclarator.add_parameter (new CCodeFormalParameter ("any", "DovaObject *"));
+                       vdeclarator.add_parameter (new CCodeFormalParameter ("any_", "any *"));
                        vdeclarator.add_parameter (new CCodeFormalParameter ("value", "void *"));
                        vdeclarator.add_parameter (new CCodeFormalParameter ("value_index", "int32_t"));
 
@@ -546,8 +546,7 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
                }
                type_init_fun.block = new CCodeBlock ();
 
-               if (base_class == null) {
-               } else if (cl == object_class || cl == value_class) {
+               if (base_class == null || cl == object_class || cl == value_class) {
                        var sizeof_call = new CCodeFunctionCall (new CCodeIdentifier ("sizeof"));
                        sizeof_call.add_argument (new CCodeIdentifier ("void *"));
 
@@ -658,12 +657,12 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
                        // generate method to unbox value
                        var value_from_any_fun = new CCodeFunction ("%s_value_from_any".printf (cl.get_lower_case_cname ()));
                        value_from_any_fun.modifiers = CCodeModifiers.STATIC;
-                       value_from_any_fun.add_parameter (new CCodeFormalParameter ("any", "DovaObject *"));
+                       value_from_any_fun.add_parameter (new CCodeFormalParameter ("any_", "any *"));
                        value_from_any_fun.add_parameter (new CCodeFormalParameter ("value", cl.get_cname () + "**"));
                        value_from_any_fun.add_parameter (new CCodeFormalParameter ("value_index", "int32_t"));
                        value_from_any_fun.block = new CCodeBlock ();
                        ccall = new CCodeFunctionCall (new CCodeIdentifier ("%s_ref".printf (cl.get_lower_case_cname ())));
-                       ccall.add_argument (new CCodeIdentifier ("any"));
+                       ccall.add_argument (new CCodeIdentifier ("any_"));
                        value_from_any_fun.block.add_statement (new CCodeExpressionStatement (new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, val), ccall)));
                        value_from_any_fun.block.add_statement (new CCodeReturnStatement (ccall));
                        source_type_member_definition.append (value_from_any_fun);
@@ -896,14 +895,14 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
 
                        var value_from_any_function = new CCodeFunction ("dova_type_value_from_any", "void");
                        value_from_any_function.add_parameter (new CCodeFormalParameter ("type", "DovaType *"));
-                       value_from_any_function.add_parameter (new CCodeFormalParameter ("any", "DovaObject *"));
+                       value_from_any_function.add_parameter (new CCodeFormalParameter ("any_", "any *"));
                        value_from_any_function.add_parameter (new CCodeFormalParameter ("value", "void *"));
                        value_from_any_function.add_parameter (new CCodeFormalParameter ("value_index", "int32_t"));
 
                        value_from_any_function.block = new CCodeBlock ();
 
                        ccall = new CCodeFunctionCall (new CCodeMemberAccess.pointer (priv_call, "value_from_any"));
-                       ccall.add_argument (new CCodeIdentifier ("any"));
+                       ccall.add_argument (new CCodeIdentifier ("any_"));
                        ccall.add_argument (new CCodeIdentifier ("value"));
                        ccall.add_argument (new CCodeIdentifier ("value_index"));
                        value_from_any_function.block.add_statement (new CCodeReturnStatement (ccall));
index ddb2d9214ffb91b89653be07edf7ec51bdc59843..aaf675d693c43fcbbe39d26de66ac8b82d96bbf1 100644 (file)
@@ -272,12 +272,12 @@ internal class Vala.DovaValueModule : DovaObjectModule {
                // generate method to unbox values
                var value_from_any_fun = new CCodeFunction ("%s_value_from_any".printf (st.get_lower_case_cname ()));
                value_from_any_fun.modifiers = CCodeModifiers.STATIC;
-               value_from_any_fun.add_parameter (new CCodeFormalParameter ("any", "DovaObject *"));
+               value_from_any_fun.add_parameter (new CCodeFormalParameter ("any_", "any *"));
                value_from_any_fun.add_parameter (new CCodeFormalParameter ("value", st.get_cname () + "*"));
                value_from_any_fun.add_parameter (new CCodeFormalParameter ("value_index", "int32_t"));
                value_from_any_fun.block = new CCodeBlock ();
                priv_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_GET_PRIVATE".printf (st.get_upper_case_cname (null))));
-               priv_call.add_argument (new CCodeIdentifier ("any"));
+               priv_call.add_argument (new CCodeIdentifier ("any_"));
                copy_call = new CCodeFunctionCall (new CCodeIdentifier ("%s_copy".printf (st.get_lower_case_cname ())));
                copy_call.add_argument (new CCodeIdentifier ("value"));
                copy_call.add_argument (new CCodeIdentifier ("value_index"));