]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: *Drop* support for non-auto property initializer in gobjects
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 19 Apr 2018 12:51:12 +0000 (14:51 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 19 Apr 2018 15:41:10 +0000 (17:41 +0200)
Partly reverts 73e553ac3488d641fb08b275bcf2636e3cf0de67
https://bugzilla.gnome.org/show_bug.cgi?id=701978

https://bugzilla.gnome.org/show_bug.cgi?id=795225

codegen/valagobjectmodule.vala
tests/Makefile.am
tests/objects/bug701978.vala [deleted file]

index 82eba077421bfc986e96ec643e69f1e0518ef40e..11aa6e686a23a37d35390b431fdc758e5a06c4d2 100644 (file)
@@ -688,27 +688,6 @@ public class Vala.GObjectModule : GTypeModule {
 
                if (is_gobject_property (prop) && prop.parent_symbol is Class) {
                        prop_enum.add_value (new CCodeEnumValue ("%s_PROPERTY".printf (get_ccode_upper_case_name (prop))));
-
-                       if (prop.initializer != null && prop.set_accessor != null && !prop.set_accessor.automatic_body) {
-                               // generate a custom initializer if it couldn't be done at class_init time
-                               bool has_spec_initializer = prop.property_type.data_type is Enum;
-                               if (!has_spec_initializer && prop.property_type.data_type is Struct) {
-                                       var param_spec_func = get_ccode_param_spec_function (prop.property_type.data_type);
-                                       has_spec_initializer = param_spec_func != "g_param_spec_boxed";
-                               }
-                               if (!has_spec_initializer) {
-                                       push_context (instance_init_context);
-
-                                       prop.initializer.emit (this);
-
-                                       var inst_ma = new MemberAccess.simple ("this");
-                                       inst_ma.target_value = new GLibValue (get_data_type_for_symbol ((Class) prop.parent_symbol), new CCodeIdentifier ("self"), true);
-                                       store_property (prop, inst_ma, prop.initializer.target_value);
-
-                                       temp_ref_values.clear ();
-                                       pop_context ();
-                               }
-                       }
                }
        }
 
index de61c5821d45810cab93faec3c7b5d1ff810cf65..5ec1473c5af0368120c2f62499486c66394fc4cf 100644 (file)
@@ -286,7 +286,6 @@ TESTS = \
        objects/bug681356.vala \
        objects/bug683646.vala \
        objects/bug695671.vala \
-       objects/bug701978.vala \
        objects/bug702736.vala \
        objects/bug702846.vala \
        objects/bug731547.vala \
diff --git a/tests/objects/bug701978.vala b/tests/objects/bug701978.vala
deleted file mode 100644 (file)
index 22fcfaf..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-public struct Foo {
-       public int val { get; set; }
-
-       public Foo () {
-               val = 55;
-       }
-}
-
-public class Bar : Object {
-       private Foo _foo;
-
-       public Foo foo {
-               get { return _foo; }
-               set { _foo = value; }
-               default = Foo ();
-       }
-}
-
-void main () {
-       var bar = new Bar();
-       assert (bar.foo.val == 55);
-}