]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Set more missing source references of CodeNode instances
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 17 Oct 2021 07:15:58 +0000 (09:15 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 19 Oct 2021 07:51:43 +0000 (09:51 +0200)
vala/valaaddressofexpression.vala
vala/valaassignment.vala
vala/valaenumvaluetype.vala
vala/valaforeachstatement.vala
vala/valalambdaexpression.vala
vala/valamemberaccess.vala
vala/valamethod.vala
vala/valamethodcall.vala
vala/valasignal.vala
vala/valasignaltype.vala
vala/valasliceexpression.vala

index a186146515390eee8ef092b3f5d846233ff28e28..9e89b03bd09e3b91fdbb93d134cc5fb54e7d41e5 100644 (file)
@@ -109,9 +109,9 @@ public class Vala.AddressofExpression : Expression {
                }
 
                if (inner.value_type.is_reference_type_or_type_parameter ()) {
-                       value_type = new PointerType (new PointerType (inner.value_type));
+                       value_type = new PointerType (new PointerType (inner.value_type), source_reference);
                } else {
-                       value_type = new PointerType (inner.value_type);
+                       value_type = new PointerType (inner.value_type, source_reference);
                }
 
                return !error;
index dfd6fc22ea00f24e48bcff63aeaadd16df0543ac..621e96aac04a5e5c04204b8e72d606791c55b7f0 100644 (file)
@@ -229,7 +229,7 @@ public class Vala.Assignment : Expression {
                        // FIXME: only do this if the backend doesn't support
                        // the assignment natively
 
-                       var old_value = new MemberAccess (ma.inner, ma.member_name);
+                       var old_value = new MemberAccess (ma.inner, ma.member_name, source_reference);
 
                        BinaryOperator bop;
 
index 1038286087afaeab445683b1e5a41ec46d7904fc..dedc6b07cb7d69bd2e9ed35e782221795f661ccc 100644 (file)
@@ -45,7 +45,7 @@ public class Vala.EnumValueType : ValueType {
                if (to_string_method == null) {
                        var string_type = new ObjectType ((Class) CodeContext.get ().root.scope.lookup ("string"));
                        string_type.value_owned = false;
-                       to_string_method = new Method ("to_string", string_type);
+                       to_string_method = new Method ("to_string", string_type, source_reference);
                        to_string_method.access = SymbolAccessibility.PUBLIC;
                        to_string_method.is_extern = true;
                        if (CodeContext.get ().profile == Profile.POSIX) {
@@ -54,7 +54,7 @@ public class Vala.EnumValueType : ValueType {
                                to_string_method.set_attribute_string ("CCode", "cheader_filename", "glib-object.h");
                        }
                        to_string_method.owner = type_symbol.scope;
-                       to_string_method.this_parameter = new Parameter ("this", copy ());
+                       to_string_method.this_parameter = new Parameter ("this", copy (), source_reference);
                        to_string_method.scope.add (to_string_method.this_parameter.name, to_string_method.this_parameter);
                }
                return to_string_method;
index e225047bc955973553df097a6a9d58c41bcf91fb..bf03e7491ca8f9d5bd8a165348f2ec35e501cb86 100644 (file)
@@ -391,7 +391,7 @@ public class Vala.ForeachStatement : Block {
 
                context.analyzer.current_symbol = context.analyzer.current_symbol.parent_symbol;
 
-               collection_variable = new LocalVariable (collection_type.copy (), "%s_collection".printf (variable_name));
+               collection_variable = new LocalVariable (collection_type.copy (), "%s_collection".printf (variable_name), null, source_reference);
 
                add_local_variable (collection_variable);
                collection_variable.active = true;
index b699274e26390569f9433fd96328f4186b846d57..83e0fa63187dcb4090556833ad4f52887caf5921 100644 (file)
@@ -264,6 +264,7 @@ public class Vala.LambdaExpression : Expression {
                method.check (context);
 
                value_type = new MethodType (method);
+               value_type.source_reference = source_reference;
                value_type.value_owned = target_type.value_owned;
 
                return !error;
index 59c1f445a86e026a06de1d674df904e0c7a03cd5..fef4e6d3f78ac8d79f79d709f8ef04a1cf75cdb9 100644 (file)
@@ -427,7 +427,7 @@ public class Vala.MemberAccess : Expression {
                                                }
                                                var m = new DynamicMethod (inner.value_type, member_name, ret_type, source_reference);
                                                m.invocation = invoc;
-                                               var err = new ErrorType (null, null);
+                                               var err = new ErrorType (null, null, m.source_reference);
                                                err.dynamic_error = true;
                                                m.add_error_type (err);
                                                m.access = SymbolAccessibility.PUBLIC;
@@ -911,10 +911,13 @@ public class Vala.MemberAccess : Expression {
                                // required when using instance methods as delegates in constants
                                // TODO replace by MethodPrototype
                                value_type = context.analyzer.get_value_type_for_symbol (symbol_reference, lvalue);
+                               value_type.source_reference = source_reference;
                        } else if (symbol_reference is Field) {
                                value_type = new FieldPrototype ((Field) symbol_reference);
+                               value_type.source_reference = source_reference;
                        } else if (symbol_reference is Property) {
                                value_type = new PropertyPrototype ((Property) symbol_reference);
+                               value_type.source_reference = source_reference;
                        } else {
                                error = true;
                                value_type = new InvalidType ();
@@ -965,6 +968,7 @@ public class Vala.MemberAccess : Expression {
                            inner != null && inner.value_type == null && inner_ma.type_argument_list.size > 0) {
                                // support static methods in generic classes
                                inner.value_type = new ObjectType ((ObjectTypeSymbol) m.parent_symbol);
+                               inner.value_type.source_reference = source_reference;
 
                                foreach (var type_argument in inner_ma.type_argument_list) {
                                        inner.value_type.add_type_argument (type_argument);
index 4b604b6c44b2eda0b8097e86581ce02b9d89be4e..42f74a10b3db38658918cb2641c1c3aafae0c1a6 100644 (file)
@@ -1232,11 +1232,12 @@ public class Vala.Method : Subroutine, Callable {
                }
 
                var callback_type = new DelegateType ((Delegate) glib_ns.scope.lookup ("AsyncReadyCallback"));
+               callback_type.source_reference = source_reference;
                callback_type.nullable = true;
                callback_type.value_owned = true;
                callback_type.is_called_once = true;
 
-               var callback_param = new Parameter ("_callback_", callback_type);
+               var callback_param = new Parameter ("_callback_", callback_type, source_reference);
                callback_param.initializer = new NullLiteral (source_reference);
                callback_param.initializer.target_type = callback_type.copy ();
                callback_param.set_attribute_double ("CCode", "pos", -1);
@@ -1259,7 +1260,7 @@ public class Vala.Method : Subroutine, Callable {
                var glib_ns = CodeContext.get ().root.scope.lookup ("GLib");
                var result_type = new ObjectType ((ObjectTypeSymbol) glib_ns.scope.lookup ("AsyncResult"));
 
-               var result_param = new Parameter ("_res_", result_type);
+               var result_param = new Parameter ("_res_", result_type, source_reference);
                result_param.set_attribute_double ("CCode", "pos", get_attribute_double ("CCode", "async_result_pos", 0.1));
                params.add (result_param);
 
index 4da21c265b119947357ba7678e13cb78f5f06fb0..2abdc74e523d9fff9f1da69f222c4852bff90fb0 100644 (file)
@@ -296,6 +296,7 @@ public class Vala.MethodCall : Expression {
                                        return false;
                                }
                                call.value_type = new ObjectType (context.analyzer.object_type);
+                               call.value_type.source_reference = source_reference;
                                mtype = call.value_type;
                        }
                }
@@ -562,6 +563,7 @@ public class Vala.MethodCall : Expression {
                                        }
                                }
                                dynamic_sig.handler.target_type = new DelegateType (dynamic_sig.get_delegate (new ObjectType ((ObjectTypeSymbol) dynamic_sig.parent_symbol), this));
+                               dynamic_sig.handler.target_type.source_reference = source_reference;
                        }
 
                        if (m != null && m.has_type_parameters ()) {
@@ -627,6 +629,7 @@ public class Vala.MethodCall : Expression {
                                unowned MemberAccess ma = (MemberAccess) call;
                                if (ma.member_name == "end") {
                                        mtype = new MethodType (m.get_end_method ());
+                                       mtype.source_reference = source_reference;
                                }
                        }
                }
index c6354261702fe8bb4533bfb0015eb9bd25dabfd0..8a173b4c8d63b0e9fe56f727eacc56fb999ff682 100644 (file)
@@ -104,7 +104,7 @@ public class Vala.Signal : Symbol, Callable {
        public Delegate get_delegate (DataType sender_type, CodeNode node_reference) {
                var actual_return_type = return_type.get_actual_type (sender_type, null, node_reference);
 
-               var generated_delegate = new Delegate (null, actual_return_type);
+               var generated_delegate = new Delegate (null, actual_return_type, source_reference);
                generated_delegate.access = SymbolAccessibility.PUBLIC;
                generated_delegate.owner = scope;
 
index db7934f99167110727bf01b78875d470c331e26e..82ae35641710f2cceb9f3199c9aa182e31fc63f6 100644 (file)
@@ -56,11 +56,13 @@ public class Vala.SignalType : CallableType {
                var type_sym = (ObjectTypeSymbol) signal_symbol.parent_symbol;
                var sender_type = SemanticAnalyzer.get_data_type_for_symbol (type_sym);
                var result = new DelegateType (signal_symbol.get_delegate (sender_type, this));
+               result.source_reference = source_reference;
                result.value_owned = true;
 
                if (result.delegate_symbol.has_type_parameters ()) {
                        foreach (var type_param in type_sym.get_type_parameters ()) {
                                var type_arg = new GenericType (type_param);
+                               type_arg.source_reference = source_reference;
                                type_arg.value_owned = true;
                                result.add_type_argument (type_arg);
                        }
@@ -72,11 +74,11 @@ public class Vala.SignalType : CallableType {
        unowned Method get_connect_method () {
                if (connect_method == null) {
                        var ulong_type = new IntegerType ((Struct) CodeContext.get ().root.scope.lookup ("ulong"));
-                       connect_method = new Method ("connect", ulong_type);
+                       connect_method = new Method ("connect", ulong_type, source_reference);
                        connect_method.access = SymbolAccessibility.PUBLIC;
                        connect_method.external = true;
                        connect_method.owner = signal_symbol.scope;
-                       connect_method.add_parameter (new Parameter ("handler", get_handler_type ()));
+                       connect_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference));
                }
                return connect_method;
        }
@@ -84,22 +86,22 @@ public class Vala.SignalType : CallableType {
        unowned Method get_connect_after_method () {
                if (connect_after_method == null) {
                        var ulong_type = new IntegerType ((Struct) CodeContext.get ().root.scope.lookup ("ulong"));
-                       connect_after_method = new Method ("connect_after", ulong_type);
+                       connect_after_method = new Method ("connect_after", ulong_type, source_reference);
                        connect_after_method.access = SymbolAccessibility.PUBLIC;
                        connect_after_method.external = true;
                        connect_after_method.owner = signal_symbol.scope;
-                       connect_after_method.add_parameter (new Parameter ("handler", get_handler_type ()));
+                       connect_after_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference));
                }
                return connect_after_method;
        }
 
        unowned Method get_disconnect_method () {
                if (disconnect_method == null) {
-                       disconnect_method = new Method ("disconnect", new VoidType ());
+                       disconnect_method = new Method ("disconnect", new VoidType (), source_reference);
                        disconnect_method.access = SymbolAccessibility.PUBLIC;
                        disconnect_method.external = true;
                        disconnect_method.owner = signal_symbol.scope;
-                       disconnect_method.add_parameter (new Parameter ("handler", get_handler_type ()));
+                       disconnect_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference));
                }
                return disconnect_method;
        }
index 3d397ceee6475a4c6d484e37914343334a7a5e15..8b28d003bbc0248888ca6474e1500365501d88c3 100644 (file)
@@ -168,7 +168,7 @@ public class Vala.SliceExpression : Expression {
                } else {
                        var slice_method = container.value_type.get_member ("slice") as Method;
                        if (slice_method != null) {
-                               var slice_call = new MethodCall (new MemberAccess (container, "slice"));
+                               var slice_call = new MethodCall (new MemberAccess (container, "slice", source_reference), source_reference);
                                slice_call.add_argument (start);
                                slice_call.add_argument (stop);
                                slice_call.target_type = this.target_type;