[vala/wip/issue/327: 36/43] Adapt MemberAccess error message to with statement
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/issue/327: 36/43] Adapt MemberAccess error message to with statement
- Date: Tue, 7 Apr 2020 07:33:38 +0000 (UTC)
commit a8802cf0603d294998f2a22f7c8e219ede9c6bf6
Author: Nick Schrader <nick schrader mailbox org>
Date: Thu Apr 2 22:32:25 2020 -0300
Adapt MemberAccess error message to with statement
vala/valamemberaccess.vala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index ab1c8b7cd..9eed17ba6 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -220,6 +220,8 @@ public class Vala.MemberAccess : Expression {
bool may_access_instance_members = false;
bool may_access_klass_members = false;
+ var visited_types = new ArrayList<DataType> ();
+
symbol_reference = null;
if (qualified) {
@@ -285,6 +287,7 @@ public class Vala.MemberAccess : Expression {
if (variable_type is PointerType) {
variable_type = ((PointerType) variable_type).base_type;
}
+ visited_types.add(variable_type);
symbol_reference = variable_type.get_member (member_name);
if (symbol_reference != null) {
@@ -520,7 +523,12 @@ public class Vala.MemberAccess : Expression {
}
}
- Report.error (source_reference, "The name `%s' does not exist in the context of
`%s'%s".printf (member_name, base_type_name, base_type_package));
+ string visited_types_string = "";
+ foreach (var type in visited_types) {
+ visited_types_string += " or `%s'".printf(type.to_string());
+ }
+
+ Report.error (source_reference, "The name `%s' does not exist in the context of
`%s'%s%s".printf (member_name, base_type_name, base_type_package, visited_types_string));
return false;
} else if (symbol_reference.error) {
//ignore previous error
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]