summaryrefslogtreecommitdiff
path: root/vala/valamemberaccess.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-07-15 17:46:58 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2020-07-15 17:46:58 +0200
commit866258f688d781f3536892b8f93abdd3112198ec (patch)
treebe391041c9d45994f4fae2e463405dd21cb29611 /vala/valamemberaccess.vala
parent5ae9d6b888f988dc83ba8b99d3447dc5b70f6baa (diff)
downloadvala-866258f688d781f3536892b8f93abdd3112198ec.tar.gz
vala: Fully qualify member-access when using-directive was used to resolve
Fixes https://gitlab.gnome.org/GNOME/vala/issues/57
Diffstat (limited to 'vala/valamemberaccess.vala')
-rw-r--r--vala/valamemberaccess.vala11
1 files changed, 11 insertions, 0 deletions
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index db022fefd..02d3b50ad 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -337,6 +337,17 @@ public class Vala.MemberAccess : Expression {
Report.error (source_reference, "`%s' is an ambiguous reference between `%s' and `%s'".printf (member_name, symbol_reference.get_full_name (), local_sym.get_full_name ()));
return false;
}
+
+ // Transform to fully qualified member access
+ unowned Symbol? inner_sym = local_sym.parent_symbol;
+ unowned MemberAccess? inner_ma = this;
+ while (inner_sym != null && inner_sym.name != null) {
+ inner_ma.inner = new MemberAccess (null, inner_sym.name, source_reference);
+ inner_ma = (MemberAccess) inner_ma.inner;
+ inner_sym = inner_sym.parent_symbol;
+ }
+ inner.check (context);
+
symbol_reference = local_sym;
}
}