]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Point to the invalid initializer on error
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 15 Apr 2024 06:38:39 +0000 (08:38 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 15 Apr 2024 08:29:10 +0000 (10:29 +0200)
vala/valafield.vala
vala/valalocalvariable.vala

index dc5d1df16ca199aa7baed9e612c55799eb7c61c6..5bfaf773eaa0432a97fcd2640cfcb67c7f7f7d6f 100644 (file)
@@ -157,7 +157,7 @@ public class Vala.Field : Variable, Lockable {
 
                        if (initializer.value_type == null) {
                                error = true;
-                               Report.error (source_reference, "expression type not allowed as initializer");
+                               Report.error (initializer.source_reference, "expression type not allowed as initializer");
                                return false;
                        }
 
index 7fbde469f2d8926964da2678da81f49846db1d17..95e0e6575812b8b196eb816f25cf79e15963fa2a 100644 (file)
@@ -195,7 +195,7 @@ public class Vala.LocalVariable : Variable {
                        if (initializer.value_type is MethodType) {
                                if (!(initializer is MemberAccess) && !(initializer is LambdaExpression)) {
                                        error = true;
-                                       Report.error (source_reference, "expression type not allowed as initializer");
+                                       Report.error (initializer.source_reference, "expression type not allowed as initializer");
                                        return false;
                                }
 
@@ -210,12 +210,12 @@ public class Vala.LocalVariable : Variable {
                                        }
                                } else {
                                        error = true;
-                                       Report.error (source_reference, "expression type not allowed as initializer");
+                                       Report.error (initializer.source_reference, "expression type not allowed as initializer");
                                        return false;
                                }
                        } else if (initializer.value_type == null) {
                                error = true;
-                               Report.error (source_reference, "expression type not allowed as initializer");
+                               Report.error (initializer.source_reference, "expression type not allowed as initializer");
                                return false;
                        }