]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Add package_name to missing member error for external MemberAccess
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 22 Sep 2019 15:27:00 +0000 (17:27 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 25 Sep 2019 13:19:25 +0000 (15:19 +0200)
This provides information about the origin of the accessed symbol.

vala/valamemberaccess.vala

index ad3f3d0fc9e3d6a8a342feae409ba77887620dbf..132f72d05649949029b59c150904c1db496170de 100644 (file)
@@ -468,13 +468,24 @@ public class Vala.MemberAccess : Expression {
                        error = true;
 
                        string base_type_name = "(null)";
+                       unowned Symbol? base_type = null;
                        if (inner != null && inner.value_type != null) {
                                base_type_name = inner.value_type.to_string ();
+                               base_type = inner.value_type.data_type;
                        } else if (base_symbol != null) {
                                base_type_name = base_symbol.get_full_name ();
+                               base_type = base_symbol;
                        }
 
-                       Report.error (source_reference, "The name `%s' does not exist in the context of `%s'".printf (member_name, base_type_name));
+                       string? base_type_package = "";
+                       if (base_type != null && base_type.external_package) {
+                               base_type_package = base_symbol.source_reference.file.package_name;
+                               if (base_type_package != null) {
+                                       base_type_package = " (%s)".printf (base_type_package);
+                               }
+                       }
+
+                       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));
                        return false;
                }