[vala/staging] vala: Add optional SourceReference parameter to DataType classes



commit 40a92385fc0a7862dce4757dd692f241728b0aba
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Sep 28 15:09:25 2021 +0200

    vala: Add optional SourceReference parameter to DataType classes

 vala/valaarraytype.vala         |  3 +--
 vala/valabooleantype.vala       |  7 +++----
 vala/valacallabletype.vala      |  4 ++--
 vala/valaclasstype.vala         |  4 ++--
 vala/valadatatype.vala          |  3 ++-
 vala/valadelegatetype.vala      |  7 +++----
 vala/valaenumvaluetype.vala     |  7 +++----
 vala/valaerrortype.vala         |  3 +--
 vala/valafieldprototype.vala    |  6 +++---
 vala/valafloatingtype.vala      |  7 +++----
 vala/valagenerictype.vala       |  3 ++-
 vala/valaintegertype.vala       |  7 +++----
 vala/valainterfacetype.vala     |  6 +++---
 vala/valamethodtype.vala        |  6 +++---
 vala/valanulltype.vala          |  3 +--
 vala/valaobjecttype.vala        |  4 ++--
 vala/valapointertype.vala       |  2 +-
 vala/valapropertyprototype.vala |  6 +++---
 vala/valareferencetype.vala     |  4 ++--
 vala/valasignaltype.vala        |  6 +++---
 vala/valastructvaluetype.vala   |  7 +++----
 vala/valaunresolvedtype.vala    | 10 +++++-----
 vala/valavaluetype.vala         |  4 ++--
 23 files changed, 56 insertions(+), 63 deletions(-)
---
diff --git a/vala/valaarraytype.vala b/vala/valaarraytype.vala
index 85b7b1f45..55847d5db 100644
--- a/vala/valaarraytype.vala
+++ b/vala/valaarraytype.vala
@@ -84,10 +84,9 @@ public class Vala.ArrayType : ReferenceType {
        private ArrayCopyMethod copy_method;
 
        public ArrayType (DataType element_type, int rank, SourceReference? source_reference = null) {
-               base (null);
+               base (null, source_reference);
                this.element_type = element_type;
                this.rank = rank;
-               this.source_reference = source_reference;
        }
 
        public override Symbol? get_member (string member_name) {
diff --git a/vala/valabooleantype.vala b/vala/valabooleantype.vala
index b224a9359..b6d31259e 100644
--- a/vala/valabooleantype.vala
+++ b/vala/valabooleantype.vala
@@ -26,13 +26,12 @@ using GLib;
  * A boolean type.
  */
 public class Vala.BooleanType : ValueType {
-       public BooleanType (Struct type_symbol) {
-               base (type_symbol);
+       public BooleanType (Struct type_symbol, SourceReference? source_reference = null) {
+               base (type_symbol, source_reference);
        }
 
        public override DataType copy () {
-               var result = new BooleanType ((Struct) type_symbol);
-               result.source_reference = source_reference;
+               var result = new BooleanType ((Struct) type_symbol, source_reference);
                result.value_owned = value_owned;
                result.nullable = nullable;
                return result;
diff --git a/vala/valacallabletype.vala b/vala/valacallabletype.vala
index a3da19518..93f8738db 100644
--- a/vala/valacallabletype.vala
+++ b/vala/valacallabletype.vala
@@ -32,8 +32,8 @@ public abstract class Vala.CallableType : DataType {
                }
        }
 
-       protected CallableType (Symbol symbol) {
-               base.with_symbol (symbol);
+       protected CallableType (Symbol symbol, SourceReference? source_reference = null) {
+               base.with_symbol (symbol, source_reference);
        }
 
        public override bool is_invokable () {
diff --git a/vala/valaclasstype.vala b/vala/valaclasstype.vala
index 39681225a..96c1313c6 100644
--- a/vala/valaclasstype.vala
+++ b/vala/valaclasstype.vala
@@ -35,8 +35,8 @@ public class Vala.ClassType : ReferenceType {
                }
        }
 
-       public ClassType (Class class_symbol) {
-               base (class_symbol);
+       public ClassType (Class class_symbol, SourceReference? source_reference = null) {
+               base (class_symbol, source_reference);
        }
 
        public override DataType copy () {
diff --git a/vala/valadatatype.vala b/vala/valadatatype.vala
index 8ad4cc0cc..8d190e0ad 100644
--- a/vala/valadatatype.vala
+++ b/vala/valadatatype.vala
@@ -71,8 +71,9 @@ 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) {
+       protected DataType.with_symbol (Symbol? symbol, SourceReference? source_reference = null) {
                this.symbol = symbol;
+               this.source_reference = source_reference;
        }
 
        /**
diff --git a/vala/valadelegatetype.vala b/vala/valadelegatetype.vala
index e23eb15a1..861a32806 100644
--- a/vala/valadelegatetype.vala
+++ b/vala/valadelegatetype.vala
@@ -37,8 +37,8 @@ public class Vala.DelegateType : CallableType {
        DelegateTargetField? target_field;
        DelegateDestroyField? destroy_field;
 
-       public DelegateType (Delegate delegate_symbol) {
-               base (delegate_symbol);
+       public DelegateType (Delegate delegate_symbol, SourceReference? source_reference = null) {
+               base (delegate_symbol, source_reference);
                this.is_called_once = (delegate_symbol.get_attribute_string ("CCode", "scope") == "async");
        }
 
@@ -68,8 +68,7 @@ public class Vala.DelegateType : CallableType {
        }
 
        public override DataType copy () {
-               var result = new DelegateType (delegate_symbol);
-               result.source_reference = source_reference;
+               var result = new DelegateType (delegate_symbol, source_reference);
                result.value_owned = value_owned;
                result.nullable = nullable;
 
diff --git a/vala/valaenumvaluetype.vala b/vala/valaenumvaluetype.vala
index aa3ff0bb4..578813078 100644
--- a/vala/valaenumvaluetype.vala
+++ b/vala/valaenumvaluetype.vala
@@ -28,13 +28,12 @@ using GLib;
 public class Vala.EnumValueType : ValueType {
        private Method? to_string_method;
 
-       public EnumValueType (Enum type_symbol) {
-               base (type_symbol);
+       public EnumValueType (Enum type_symbol, SourceReference? source_reference = null) {
+               base (type_symbol, source_reference);
        }
 
        public override DataType copy () {
-               var result = new EnumValueType ((Enum) type_symbol);
-               result.source_reference = source_reference;
+               var result = new EnumValueType ((Enum) type_symbol, source_reference);
                result.value_owned = value_owned;
                result.nullable = nullable;
 
diff --git a/vala/valaerrortype.vala b/vala/valaerrortype.vala
index f287911a8..55e08707c 100644
--- a/vala/valaerrortype.vala
+++ b/vala/valaerrortype.vala
@@ -44,9 +44,8 @@ public class Vala.ErrorType : ReferenceType {
        public bool dynamic_error { get; set; }
 
        public ErrorType (ErrorDomain? error_domain, ErrorCode? error_code, SourceReference? source_reference 
= null) {
-               base ((Symbol) error_domain ?? CodeContext.get ().root.scope.lookup ("GLib").scope.lookup 
("Error"));
+               base ((Symbol) error_domain ?? CodeContext.get ().root.scope.lookup ("GLib").scope.lookup 
("Error"), source_reference);
                this.error_code = error_code;
-               this.source_reference = source_reference;
        }
 
        public override bool compatible (DataType target_type) {
diff --git a/vala/valafieldprototype.vala b/vala/valafieldprototype.vala
index 3813a55c9..9bdc28ac0 100644
--- a/vala/valafieldprototype.vala
+++ b/vala/valafieldprototype.vala
@@ -32,12 +32,12 @@ public class Vala.FieldPrototype : DataType {
                }
        }
 
-       public FieldPrototype (Field field_symbol) {
-               base.with_symbol (field_symbol);
+       public FieldPrototype (Field field_symbol, SourceReference? source_reference = null) {
+               base.with_symbol (field_symbol, source_reference);
        }
 
        public override DataType copy () {
-               var result = new FieldPrototype (field_symbol);
+               var result = new FieldPrototype (field_symbol, source_reference);
                return result;
        }
 
diff --git a/vala/valafloatingtype.vala b/vala/valafloatingtype.vala
index 83c4abee6..87dec1fe2 100644
--- a/vala/valafloatingtype.vala
+++ b/vala/valafloatingtype.vala
@@ -26,13 +26,12 @@ using GLib;
  * A floating-point type.
  */
 public class Vala.FloatingType : ValueType {
-       public FloatingType (Struct type_symbol) {
-               base (type_symbol);
+       public FloatingType (Struct type_symbol, SourceReference? source_reference = null) {
+               base (type_symbol, source_reference);
        }
 
        public override DataType copy () {
-               var result = new FloatingType ((Struct) type_symbol);
-               result.source_reference = source_reference;
+               var result = new FloatingType ((Struct) type_symbol, source_reference);
                result.value_owned = value_owned;
                result.nullable = nullable;
                return result;
diff --git a/vala/valagenerictype.vala b/vala/valagenerictype.vala
index 1f7a2d1ee..673b606db 100644
--- a/vala/valagenerictype.vala
+++ b/vala/valagenerictype.vala
@@ -34,8 +34,9 @@ public class Vala.GenericType : DataType {
        GenericDupField? dup_field;
        GenericDestroyField? destroy_field;
 
-       public GenericType (TypeParameter type_parameter) {
+       public GenericType (TypeParameter type_parameter, SourceReference? source_reference = null) {
                this.type_parameter = type_parameter;
+               this.source_reference = source_reference;
                // type parameters are always considered nullable
                this.nullable = true;
        }
diff --git a/vala/valaintegertype.vala b/vala/valaintegertype.vala
index 953958667..a5b189639 100644
--- a/vala/valaintegertype.vala
+++ b/vala/valaintegertype.vala
@@ -29,15 +29,14 @@ public class Vala.IntegerType : ValueType {
        string? literal_value;
        string? literal_type_name;
 
-       public IntegerType (Struct type_symbol, string? literal_value = null, string? literal_type_name = 
null) {
-               base (type_symbol);
+       public IntegerType (Struct type_symbol, string? literal_value = null, string? literal_type_name = 
null, SourceReference? source_reference = null) {
+               base (type_symbol, source_reference);
                this.literal_value = literal_value;
                this.literal_type_name = literal_type_name;
        }
 
        public override DataType copy () {
-               var result = new IntegerType ((Struct) type_symbol, literal_value, literal_type_name);
-               result.source_reference = source_reference;
+               var result = new IntegerType ((Struct) type_symbol, literal_value, literal_type_name, 
source_reference);
                result.value_owned = value_owned;
                result.nullable = nullable;
                return result;
diff --git a/vala/valainterfacetype.vala b/vala/valainterfacetype.vala
index 90d20190c..9c31209ed 100644
--- a/vala/valainterfacetype.vala
+++ b/vala/valainterfacetype.vala
@@ -35,12 +35,12 @@ public class Vala.InterfaceType : ReferenceType {
                }
        }
 
-       public InterfaceType (Interface interface_symbol) {
-               base (interface_symbol);
+       public InterfaceType (Interface interface_symbol, SourceReference? source_reference = null) {
+               base (interface_symbol, source_reference);
        }
 
        public override DataType copy () {
-               var result = new InterfaceType (interface_symbol);
+               var result = new InterfaceType (interface_symbol, source_reference);
                result.source_reference = source_reference;
                result.value_owned = value_owned;
                result.nullable = nullable;
diff --git a/vala/valamethodtype.vala b/vala/valamethodtype.vala
index 2fc531870..76641b041 100644
--- a/vala/valamethodtype.vala
+++ b/vala/valamethodtype.vala
@@ -32,12 +32,12 @@ public class Vala.MethodType : CallableType {
                }
        }
 
-       public MethodType (Method method_symbol) {
-               base (method_symbol);
+       public MethodType (Method method_symbol, SourceReference? source_reference = null) {
+               base (method_symbol, source_reference);
        }
 
        public override DataType copy () {
-               return new MethodType (method_symbol);
+               return new MethodType (method_symbol, source_reference);
        }
 
        public override bool compatible (DataType target_type) {
diff --git a/vala/valanulltype.vala b/vala/valanulltype.vala
index c2accf907..630f1225d 100644
--- a/vala/valanulltype.vala
+++ b/vala/valanulltype.vala
@@ -27,9 +27,8 @@ using GLib;
  */
 public class Vala.NullType : ReferenceType {
        public NullType (SourceReference? source_reference = null) {
-               base (null);
+               base (null, source_reference);
                this.nullable = true;
-               this.source_reference = source_reference;
        }
 
        public override bool compatible (DataType target_type) {
diff --git a/vala/valaobjecttype.vala b/vala/valaobjecttype.vala
index 8e08ade76..89a8bfe3f 100644
--- a/vala/valaobjecttype.vala
+++ b/vala/valaobjecttype.vala
@@ -35,8 +35,8 @@ public class Vala.ObjectType : ReferenceType {
                }
        }
 
-       public ObjectType (ObjectTypeSymbol type_symbol) {
-               base (type_symbol);
+       public ObjectType (ObjectTypeSymbol type_symbol, SourceReference? source_reference = null) {
+               base (type_symbol, source_reference);
        }
 
        public override DataType copy () {
diff --git a/vala/valapointertype.vala b/vala/valapointertype.vala
index a8806230e..7371de68b 100644
--- a/vala/valapointertype.vala
+++ b/vala/valapointertype.vala
@@ -50,7 +50,7 @@ public class Vala.PointerType : DataType {
        }
 
        public override DataType copy () {
-               return new PointerType (base_type.copy ());
+               return new PointerType (base_type.copy (), source_reference);
        }
 
        public override bool compatible (DataType target_type) {
diff --git a/vala/valapropertyprototype.vala b/vala/valapropertyprototype.vala
index 408fddb71..a464e397e 100644
--- a/vala/valapropertyprototype.vala
+++ b/vala/valapropertyprototype.vala
@@ -30,12 +30,12 @@ public class Vala.PropertyPrototype : DataType {
                }
        }
 
-       public PropertyPrototype (Property property_symbol) {
-               base.with_symbol (property_symbol);
+       public PropertyPrototype (Property property_symbol, SourceReference? source_reference = null) {
+               base.with_symbol (property_symbol, source_reference);
        }
 
        public override DataType copy () {
-               var result = new PropertyPrototype (property_symbol);
+               var result = new PropertyPrototype (property_symbol, source_reference);
                return result;
        }
 
diff --git a/vala/valareferencetype.vala b/vala/valareferencetype.vala
index 8317c5d26..2dbb487e5 100644
--- a/vala/valareferencetype.vala
+++ b/vala/valareferencetype.vala
@@ -26,7 +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);
+       protected ReferenceType (Symbol? symbol, SourceReference? source_reference = null) {
+               base.with_symbol (symbol, source_reference);
        }
 }
diff --git a/vala/valasignaltype.vala b/vala/valasignaltype.vala
index c64cce4a2..9de2558e2 100644
--- a/vala/valasignaltype.vala
+++ b/vala/valasignaltype.vala
@@ -36,12 +36,12 @@ public class Vala.SignalType : CallableType {
        Method? connect_after_method;
        Method? disconnect_method;
 
-       public SignalType (Signal signal_symbol) {
-               base (signal_symbol);
+       public SignalType (Signal signal_symbol, SourceReference? source_reference = null) {
+               base (signal_symbol, source_reference);
        }
 
        public override DataType copy () {
-               return new SignalType (signal_symbol);
+               return new SignalType (signal_symbol, source_reference);
        }
 
        public override bool compatible (DataType target_type) {
diff --git a/vala/valastructvaluetype.vala b/vala/valastructvaluetype.vala
index bdd20f3cd..81ca851a1 100644
--- a/vala/valastructvaluetype.vala
+++ b/vala/valastructvaluetype.vala
@@ -26,8 +26,8 @@ using GLib;
  * A struct value type.
  */
 public class Vala.StructValueType : ValueType {
-       public StructValueType (Struct type_symbol) {
-               base (type_symbol);
+       public StructValueType (Struct type_symbol, SourceReference? source_reference = null) {
+               base (type_symbol, source_reference);
        }
 
        public override bool is_invokable () {
@@ -58,8 +58,7 @@ public class Vala.StructValueType : ValueType {
        }
 
        public override DataType copy () {
-               var result = new StructValueType ((Struct) type_symbol);
-               result.source_reference = source_reference;
+               var result = new StructValueType ((Struct) type_symbol, source_reference);
                result.value_owned = value_owned;
                result.nullable = nullable;
 
diff --git a/vala/valaunresolvedtype.vala b/vala/valaunresolvedtype.vala
index 8f2f47585..21a5bea08 100644
--- a/vala/valaunresolvedtype.vala
+++ b/vala/valaunresolvedtype.vala
@@ -32,7 +32,8 @@ public class Vala.UnresolvedType : DataType {
         */
        public UnresolvedSymbol unresolved_symbol { get; set; }
 
-       public UnresolvedType () {
+       public UnresolvedType (SourceReference? source_reference = null) {
+               this.source_reference = source_reference;
        }
 
        /**
@@ -42,9 +43,9 @@ public class Vala.UnresolvedType : DataType {
         * @param source    reference to source code
         * @return          newly created type reference
         */
-       public UnresolvedType.from_symbol (UnresolvedSymbol symbol, SourceReference? source = null) {
+       public UnresolvedType.from_symbol (UnresolvedSymbol symbol, SourceReference? source_reference = null) 
{
                this.unresolved_symbol = symbol;
-               source_reference = source;
+               this.source_reference = source_reference;
        }
 
        /**
@@ -64,8 +65,7 @@ public class Vala.UnresolvedType : DataType {
        }
 
        public override DataType copy () {
-               var result = new UnresolvedType ();
-               result.source_reference = source_reference;
+               var result = new UnresolvedType (source_reference);
                result.value_owned = value_owned;
                result.nullable = nullable;
                result.is_dynamic = is_dynamic;
diff --git a/vala/valavaluetype.vala b/vala/valavaluetype.vala
index 699046fb4..bc1220e75 100644
--- a/vala/valavaluetype.vala
+++ b/vala/valavaluetype.vala
@@ -26,8 +26,8 @@ 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);
+       protected ValueType (TypeSymbol type_symbol, SourceReference? source_reference = null) {
+               base.with_symbol (type_symbol, source_reference);
        }
 
        public override bool is_disposable () {


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