]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Clean up PropertyAccessor API
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 20 Oct 2016 18:37:42 +0000 (20:37 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 8 Nov 2016 07:56:46 +0000 (08:56 +0100)
vala/valapropertyaccessor.vala
vapigen/valagidlparser.vala

index 5491f5e5f27cde72628375ec6526ccdeb763268d..90048486e056143f1eae49a1849f421c34fc0e8c 100644 (file)
@@ -38,7 +38,7 @@ public class Vala.PropertyAccessor : Subroutine {
         */
        public DataType? value_type {
                get { return _value_type; }
-               set {
+               private set {
                        _value_type = value;
                        if (value != null) {
                                _value_type.parent_node = this;
@@ -49,23 +49,23 @@ public class Vala.PropertyAccessor : Subroutine {
        /**
         * Specifies whether this accessor may be used to get the property.
         */
-       public bool readable { get; set; }
+       public bool readable { get; private set; }
        
        /**
         * Specifies whether this accessor may be used to set the property.
         */
-       public bool writable { get; set; }
+       public bool writable { get; private set; }
        
        /**
         * Specifies whether this accessor may be used to construct the
         * property.
         */
-       public bool construction { get; set; }
+       public bool construction { get; private set; }
 
        /**
         * True if the body was automatically generated
         */
-       public bool automatic_body { get; set; }
+       public bool automatic_body { get; private set; }
 
        public override bool has_result {
                get { return readable; }
@@ -74,7 +74,7 @@ public class Vala.PropertyAccessor : Subroutine {
        /**
         * Represents the generated value parameter in a set accessor.
         */
-       public Parameter value_parameter { get; set; }
+       public Parameter value_parameter { get; private set; }
 
        private DataType _value_type;
        
index 553d1c8550603df93ff8d6ea0d613a851a153eeb..86239f42e4043de95720b1f39795a337a9d3b6b4 100644 (file)
@@ -2730,12 +2730,10 @@ public class Vala.GIdlParser : CodeVisitor {
                        prop.get_accessor = new PropertyAccessor (true, false, false, prop.property_type.copy (), null, null);
                }
                if (prop_node.writable) {
-                       prop.set_accessor = new PropertyAccessor (false, false, false, prop.property_type.copy (), null, null);
                        if (prop_node.construct_only) {
-                               prop.set_accessor.construction = true;
+                               prop.set_accessor = new PropertyAccessor (false, false, true, prop.property_type.copy (), null, null);
                        } else {
-                               prop.set_accessor.writable = true;
-                               prop.set_accessor.construction = prop_node.@construct;
+                               prop.set_accessor = new PropertyAccessor (false, true, prop_node.@construct, prop.property_type.copy (), null, null);
                        }
                }