]> 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:53:21 +0000 (09:53 +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 d271d0cc469a9228cbbcbc7513bff345c96aab7a..ff542835be2f614b4148252caeae114a6ea5b743 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 8902aedf336711af3eaedb54e5269a4ecc5eaaed..46f9445a44a311c49ecac8ebfba06ba10c56a24f 100644 (file)
@@ -235,7 +235,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 aa3ff0bb467f1f685d55803bc92d666acdd3b72f..4107148b8c153e581ac498653c51e7e833414b48 100644 (file)
@@ -45,7 +45,7 @@ public class Vala.EnumValueType : ValueType {
                if (to_string_method == null) {
                        var string_type = CodeContext.get ().analyzer.string_type.copy ();
                        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 bea6c4e9360cd67167bbaeb927cb60eb2c123c03..2e5c0aaa0c530d25299a7f3fd9e7f78c02516970 100644 (file)
@@ -396,7 +396,7 @@ public class Vala.ForeachStatement : Block {
 
                context.analyzer.current_symbol = old_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 054badac573ad2fe26bfd2e32ec14c08b9f71cab..e0b70c069c5372163f957343aa015f5ddc53cd34 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 9a9b8cf5ce60a1c568a2ad933b46eef4f86fa429..82fe8d2d9c1e010825eba6e50712486428b329e9 100644 (file)
@@ -448,7 +448,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;
@@ -937,10 +937,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 ();
@@ -991,6 +994,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 8b53a1946d98e5167b4f69b4042723b7676feb9c..9044233f1b64a36ee8ab93dd5af10d04f941d9f7 100644 (file)
@@ -1244,11 +1244,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);
@@ -1275,7 +1276,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));
                scope.add (null, result_param);
                async_end_parameters.add (result_param);
index 3a7325e8b891c3e1b7fc8e13ea827bd6665a704e..e6e3d15f9c67546c7acfcc167cf9b7f1ada9c3e0 100644 (file)
@@ -296,6 +296,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
                                        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, CallableExpression {
                                        }
                                }
                                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, CallableExpression {
                                unowned MemberAccess ma = (MemberAccess) call;
                                if (ma.member_name == "end") {
                                        mtype = new MethodType (m.get_end_method ());
+                                       mtype.source_reference = source_reference;
                                }
                        }
                }
index 5c790a7cd5d7c637013a704eb7e7a60bbdf43b71..8e805d682cf82ef16c542096a46deaa6c818f9d4 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 c64cce4a2c5f89ce49cb2fd98fb2c3b3e791095f..89e1a0270569bb7fa92fce44fa57e5a0f6d7551f 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 = CodeContext.get ().analyzer.ulong_type.copy ();
-                       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 = CodeContext.get ().analyzer.ulong_type.copy ();
-                       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 a9502b3e8b6ca298532fefdc32a62dd899364a84..d219b4ab56db0782384bed2e207dc4499d5a9eed 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;