]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Unify backing symbol instance of data-types
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 12 Mar 2019 15:51:23 +0000 (16:51 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 30 Sep 2019 12:43:00 +0000 (14:43 +0200)
18 files changed:
vala/valaarraytype.vala
vala/valabooleantype.vala
vala/valacallabletype.vala
vala/valaclasstype.vala
vala/valadatatype.vala
vala/valadelegatetype.vala
vala/valaenumvaluetype.vala
vala/valaerrortype.vala
vala/valafloatingtype.vala
vala/valaintegertype.vala
vala/valainterfacetype.vala
vala/valamethodtype.vala
vala/valanulltype.vala
vala/valaobjecttype.vala
vala/valareferencetype.vala
vala/valasignaltype.vala
vala/valastructvaluetype.vala
vala/valavaluetype.vala

index 934af80b6dbd2691ef6c0bf45db530e629bddbed..76216893382d29ad7bd77f365203cbd44beb849e 100644 (file)
@@ -84,6 +84,7 @@ public class Vala.ArrayType : ReferenceType {
        private ArrayCopyMethod copy_method;
 
        public ArrayType (DataType element_type, int rank, SourceReference? source_reference) {
+               base (null);
                this.element_type = element_type;
                this.rank = rank;
                this.source_reference = source_reference;
index 13b0f04c77c1716a51dcf93a82705e98bebf1b30..b224a93593fe9dece07dce660cec51dff904cae7 100644 (file)
@@ -27,7 +27,7 @@ using GLib;
  */
 public class Vala.BooleanType : ValueType {
        public BooleanType (Struct type_symbol) {
-               this.type_symbol = type_symbol;
+               base (type_symbol);
        }
 
        public override DataType copy () {
index dd883b079fa0e7b9bb3fb12ec8bac28bad62d0e1..c41e34cc99c2477f9c8f7cde2f93f7a56255825b 100644 (file)
@@ -26,6 +26,10 @@ using GLib;
  * A callable type, i.e. a delegate, method, or signal type.
  */
 public abstract class Vala.CallableType : DataType {
+       protected CallableType (Symbol symbol) {
+               base.with_symbol (symbol);
+       }
+
        public override string to_prototype_string (string? override_name = null) {
                StringBuilder builder = new StringBuilder ();
 
index 20841cf135bc3afce569c248fc7c6da2f59b81a4..39681225a9c575350719a10b6141eb618244185e 100644 (file)
@@ -29,10 +29,14 @@ public class Vala.ClassType : ReferenceType {
        /**
         * The referred class.
         */
-       public weak Class class_symbol { get; set; }
+       public weak Class class_symbol{
+               get {
+                       return (Class) symbol;
+               }
+       }
 
        public ClassType (Class class_symbol) {
-               this.class_symbol = class_symbol;
+               base (class_symbol);
        }
 
        public override DataType copy () {
index f4013136e178a4a4aaa466389ca10a2eb340d713..02cae4d614289b38263fe7955898228bec9696a0 100644 (file)
@@ -39,10 +39,19 @@ public abstract class Vala.DataType : CodeNode {
         */
        public bool nullable { get; set; }
 
+       /**
+        * The referred symbol.
+        */
+       public weak Symbol? symbol { get; private set; }
+
        /**
         * The referred type symbol.
         */
-       public weak TypeSymbol type_symbol { get; set; }
+       public weak TypeSymbol? type_symbol {
+               get {
+                       return symbol as TypeSymbol;
+               }
+       }
 
        /**
         * Specifies that the expression transfers a floating reference.
@@ -57,6 +66,10 @@ public abstract class Vala.DataType : CodeNode {
        private List<DataType> type_argument_list;
        private static List<DataType> _empty_type_list;
 
+       protected DataType.with_symbol (Symbol? symbol) {
+               this.symbol = symbol;
+       }
+
        /**
         * Appends the specified type as generic type argument.
         *
index 01fd0d268d5aa8c15308c667115890111e2ecd52..1de80c509953d131d6b945daa128d161e50cde3d 100644 (file)
@@ -26,12 +26,16 @@ using GLib;
  * The type of an instance of a delegate.
  */
 public class Vala.DelegateType : CallableType {
-       public weak Delegate delegate_symbol { get; set; }
+       public weak Delegate delegate_symbol {
+               get {
+                       return (Delegate) symbol;
+               }
+       }
 
        public bool is_called_once { get; set; }
 
        public DelegateType (Delegate delegate_symbol) {
-               this.delegate_symbol = delegate_symbol;
+               base (delegate_symbol);
                this.is_called_once = (delegate_symbol.get_attribute_string ("CCode", "scope") == "async");
        }
 
index 0e2579295d9f1ebd382cfe822874f3b163235e3d..6c6aca3986a795026c778905475ffc3e58ccc597 100644 (file)
@@ -29,7 +29,7 @@ public class Vala.EnumValueType : ValueType {
        private Method? to_string_method;
 
        public EnumValueType (Enum type_symbol) {
-               this.type_symbol = type_symbol;
+               base (type_symbol);
        }
 
        public override DataType copy () {
index 09c58ceb8a01d87e24f75777d2a083eca757ae3f..868a41b28d02375c072f84c2b063e738c31315d3 100644 (file)
@@ -30,7 +30,11 @@ public class Vala.ErrorType : ReferenceType {
        /**
         * The error domain or null for generic error.
         */
-       public weak ErrorDomain? error_domain { get; set; }
+       public weak ErrorDomain? error_domain {
+               get {
+                       return symbol as ErrorDomain;
+               }
+       }
 
        /**
         * The error code or null for generic error.
@@ -40,8 +44,7 @@ public class Vala.ErrorType : ReferenceType {
        public bool dynamic_error { get; set; }
 
        public ErrorType (ErrorDomain? error_domain, ErrorCode? error_code, SourceReference? source_reference = null) {
-               this.error_domain = error_domain;
-               this.type_symbol = error_domain;
+               base (error_domain);
                this.error_code = error_code;
                this.source_reference = source_reference;
        }
index 06008091961a584b367cb2e32fb05962c1414de5..83c4abee60021e50854715531253bc13a46d13b7 100644 (file)
@@ -27,7 +27,7 @@ using GLib;
  */
 public class Vala.FloatingType : ValueType {
        public FloatingType (Struct type_symbol) {
-               this.type_symbol = type_symbol;
+               base (type_symbol);
        }
 
        public override DataType copy () {
index 5b1caa024b6577bf3fb9658e1639f209b4b42af5..953958667a14b5d965a5d37dcfa4a8cbb4351efe 100644 (file)
@@ -30,7 +30,7 @@ public class Vala.IntegerType : ValueType {
        string? literal_type_name;
 
        public IntegerType (Struct type_symbol, string? literal_value = null, string? literal_type_name = null) {
-               this.type_symbol = type_symbol;
+               base (type_symbol);
                this.literal_value = literal_value;
                this.literal_type_name = literal_type_name;
        }
index 6187044d165a7e5d2728152537b1efeb76d66d8d..90d20190cc27df1501958e20261d7c532049896d 100644 (file)
@@ -29,10 +29,14 @@ public class Vala.InterfaceType : ReferenceType {
        /**
         * The referred interface.
         */
-       public weak Interface interface_symbol { get; set; }
+       public weak Interface interface_symbol {
+               get {
+                       return (Interface) symbol;
+               }
+       }
 
        public InterfaceType (Interface interface_symbol) {
-               this.interface_symbol = interface_symbol;
+               base (interface_symbol);
        }
 
        public override DataType copy () {
index 4ced128ebe9dac3c8244474d110f00451b33dd49..b59b3f375ac60fd7439bb8304041fb20d7490543 100644 (file)
@@ -26,10 +26,14 @@ using GLib;
  * The type of a method referencea.
  */
 public class Vala.MethodType : CallableType {
-       public weak Method method_symbol { get; set; }
+       public weak Method method_symbol {
+               get {
+                       return (Method) symbol;
+               }
+       }
 
        public MethodType (Method method_symbol) {
-               this.method_symbol = method_symbol;
+               base (method_symbol);
        }
 
        public override bool is_invokable () {
index 92b02c8c0c717168f165c27f9e673085ed470855..ddb8c72b8264badb45d766ab809859fbd6bb8f48 100644 (file)
@@ -27,6 +27,7 @@ using GLib;
  */
 public class Vala.NullType : ReferenceType {
        public NullType (SourceReference? source_reference) {
+               base (null);
                this.nullable = true;
                this.source_reference = source_reference;
        }
index 999b746fa42d2fda159c95e57cbbab4db46b684d..97b56e16968b2c5d46645eb74ffdc148de94fa63 100644 (file)
@@ -29,11 +29,14 @@ public class Vala.ObjectType : ReferenceType {
        /**
         * The referred class or interface.
         */
-       public weak ObjectTypeSymbol object_type_symbol { get; set; }
+       public weak ObjectTypeSymbol object_type_symbol {
+               get {
+                       return (ObjectTypeSymbol) symbol;
+               }
+       }
 
        public ObjectType (ObjectTypeSymbol type_symbol) {
-               this.type_symbol = type_symbol;
-               this.object_type_symbol = type_symbol;
+               base (type_symbol);
        }
 
        public override DataType copy () {
index 6b49f53cc70b7f4bdfcf1e784b574f60127cb486..8317c5d2683b8f9d203e5abf433195f73b02380b 100644 (file)
@@ -26,4 +26,7 @@ using GLib;
  * A reference type, i.e. a class, interface, or array type.
  */
 public abstract class Vala.ReferenceType : DataType {
+       protected ReferenceType (Symbol? symbol) {
+               base.with_symbol (symbol);
+       }
 }
index 5ee83dfdcf05533baeba0a313cb73bed06c46e8c..da38a2d05e43c142790c9cf4908f40e50094b68d 100644 (file)
@@ -26,14 +26,18 @@ using GLib;
  * The type of a signal referencea.
  */
 public class Vala.SignalType : CallableType {
-       public weak Signal signal_symbol { get; set; }
+       public weak Signal signal_symbol {
+               get {
+                       return (Signal) symbol;
+               }
+       }
 
        Method? connect_method;
        Method? connect_after_method;
        Method? disconnect_method;
 
        public SignalType (Signal signal_symbol) {
-               this.signal_symbol = signal_symbol;
+               base (signal_symbol);
        }
 
        public override bool is_invokable () {
index 02a0ca609bf42dbcdc0172cbf985e022479455ee..1413b5d3289e681314f08c1bb0ca60ac0f275590 100644 (file)
@@ -27,7 +27,7 @@ using GLib;
  */
 public class Vala.StructValueType : ValueType {
        public StructValueType (Struct type_symbol) {
-               this.type_symbol = type_symbol;
+               base (type_symbol);
        }
 
        public override bool is_invokable () {
index edbeb5120b07edc8e6d68f2ab264475cc8332213..aa97f7c3973a859d9d80bba30ecd3a0ad4d3b170 100644 (file)
@@ -26,6 +26,10 @@ using GLib;
  * A value type, i.e. a struct or an enum type.
  */
 public abstract class Vala.ValueType : DataType {
+       protected ValueType (TypeSymbol type_symbol) {
+               base.with_symbol (type_symbol);
+       }
+
        public override bool is_disposable () {
                if (!value_owned) {
                        return false;