[vala/staging: 2/2] vala: Clean up PropertyAccessor API



commit 43e617dd33c335645335a5b68f8658f011de7afc
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Oct 20 20:37:42 2016 +0200

    vala: Clean up PropertyAccessor API

 vala/valapropertyaccessor.vala |   12 ++++++------
 vapigen/valagidlparser.vala    |    6 ++----
 2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/vala/valapropertyaccessor.vala b/vala/valapropertyaccessor.vala
index 5491f5e..9004848 100644
--- a/vala/valapropertyaccessor.vala
+++ b/vala/valapropertyaccessor.vala
@@ -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;
        
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 553d1c8..86239f4 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -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);
                        }
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]