]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Add optional SourceReference parameter to DataType classes
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 28 Sep 2021 13:09:25 +0000 (15:09 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 29 Sep 2021 16:29:27 +0000 (18:29 +0200)
23 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/valafieldprototype.vala
vala/valafloatingtype.vala
vala/valagenerictype.vala
vala/valaintegertype.vala
vala/valainterfacetype.vala
vala/valamethodtype.vala
vala/valanulltype.vala
vala/valaobjecttype.vala
vala/valapointertype.vala
vala/valapropertyprototype.vala
vala/valareferencetype.vala
vala/valasignaltype.vala
vala/valastructvaluetype.vala
vala/valaunresolvedtype.vala
vala/valavaluetype.vala

index 85b7b1f45fb33a6d86be4b4c9d27d26caf161233..55847d5dbc04f0c21f1daa2cafa7679589de4fe3 100644 (file)
@@ -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) {
index b224a93593fe9dece07dce660cec51dff904cae7..b6d31259eaaa0affd6011b658336f51235f09c52 100644 (file)
@@ -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;
index a3da19518c601452099a416798ebffd537e447eb..93f8738db403742e4daaa2854da32e4b46a48844 100644 (file)
@@ -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 () {
index 39681225a9c575350719a10b6141eb618244185e..96c1313c6c4eb7408a847673481ca4eb36b0de65 100644 (file)
@@ -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 () {
index 8ad4cc0cc3e16683caf3a24047e13b534ba5317a..8d190e0adb4e68f04b0b2bc9c7a834e423282d62 100644 (file)
@@ -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;
        }
 
        /**
index e23eb15a1f340856a18121959a0a5daa01da028c..861a32806083af7d0f1ac671ffbb6a29b73555fe 100644 (file)
@@ -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;
 
index aa3ff0bb467f1f685d55803bc92d666acdd3b72f..57881307811da5c9e00db361bfdb6f42905775ef 100644 (file)
@@ -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;
 
index f287911a80fa7e5b203bf2e0ee34a2fefa4b8193..55e08707c00722e4b3175adfe512a14dca0f8ca2 100644 (file)
@@ -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) {
index 3813a55c9953817647ae61d27598d1814322f778..9bdc28ac077d8419c880f66665c401bedb928de3 100644 (file)
@@ -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;
        }
 
index 83c4abee60021e50854715531253bc13a46d13b7..87dec1fe2400185de1ad0541b24f56774a5c1932 100644 (file)
@@ -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;
index 1f7a2d1eef8a9da6322d35741b178b3537a1d076..673b606dbf0653530ab4b983dee525ba082d53d7 100644 (file)
@@ -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;
        }
index 953958667a14b5d965a5d37dcfa4a8cbb4351efe..a5b189639495d28af2d57849f2247d453120ad21 100644 (file)
@@ -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;
index 90d20190cc27df1501958e20261d7c532049896d..9c31209edf5a4e15a3f625e5717722a63f263695 100644 (file)
@@ -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;
index 2fc5318709d3a39871f26773747e268a35f76235..76641b041522666898dc933d7440bc6f0a20833c 100644 (file)
@@ -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) {
index c2accf9075a8dde0ff201fb11961c773ee71f015..630f1225d1d64fd05aaf883b727d8175adc0789c 100644 (file)
@@ -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) {
index 8e08ade76b6c81e7b0a94884ff1d19916a9eaada..89a8bfe3fc71b2bd9f27e314dd4dfdb7bb93c509 100644 (file)
@@ -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 () {
index a8806230e2ee453b96cc4022966566120a39c09e..7371de68b0a25fbc329def9a6d05adcbf36eb2a2 100644 (file)
@@ -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) {
index 408fddb71a6d669a2707cf3212a2345527964035..a464e397e373610694e5abed4bd3975a9f6f167c 100644 (file)
@@ -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;
        }
 
index 8317c5d2683b8f9d203e5abf433195f73b02380b..2dbb487e5f2a5046a4b407e9fbaebcd47f5d3e0c 100644 (file)
@@ -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);
        }
 }
index c64cce4a2c5f89ce49cb2fd98fb2c3b3e791095f..9de2558e23d715e97460b0ae1c3540ce41c9ebb3 100644 (file)
@@ -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) {
index bdd20f3cd9ff52c3fdebfaefee0536879efaf4e4..81ca851a1df5156bb2f4ff24437287b4219d553b 100644 (file)
@@ -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;
 
index 8f2f4758524eed305ed2f743cdeb61bde9a1afff..21a5bea08b6aa1b97821b88b9c4b70067c5711ff 100644 (file)
@@ -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;
index 699046fb4b5e9f737242971ed158fa7d3bddae1b..bc1220e752d986d892f8bc71fa9e1b9f328fbffa 100644 (file)
@@ -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 () {