From: Rico Tzschichholz Date: Mon, 15 Apr 2024 06:38:39 +0000 (+0200) Subject: vala: Point to the invalid initializer on error X-Git-Tag: 0.56.17~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0b3c53adb850ea930c9548dc084c785d1ebc18f;p=thirdparty%2Fvala.git vala: Point to the invalid initializer on error --- diff --git a/vala/valafield.vala b/vala/valafield.vala index dc5d1df16..5bfaf773e 100644 --- a/vala/valafield.vala +++ b/vala/valafield.vala @@ -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; } diff --git a/vala/valalocalvariable.vala b/vala/valalocalvariable.vala index 7fbde469f..95e0e6575 100644 --- a/vala/valalocalvariable.vala +++ b/vala/valalocalvariable.vala @@ -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; }