]> 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 06:38:39 +0000 (08:38 +0200)
vala/valafield.vala
vala/valalocalvariable.vala

index 2f675a96f6183280969dbd07ece95efc430bc38d..0204d24d87617a4368d8351923e2e73c54cb06df 100644 (file)
@@ -158,7 +158,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 cbe612254cf270015f8ea2abfa7c89295302f8f0..099152c20c86e73d5f7ca3a4a2225867726e6fa3 100644 (file)
@@ -196,7 +196,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;
                                }
 
@@ -211,12 +211,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;
                        }