summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-09-02 15:24:40 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-09-02 15:24:40 +0800
commit8f96a8752fbeaabb6c091185d2098a65e4dd2511 (patch)
treea1819a5127153b23c29bb4965b86ca42f18250df /src/resolve
parent4398f36c4913966dfb866373bb1db1942b721dd4 (diff)
downloadmrust-8f96a8752fbeaabb6c091185d2098a65e4dd2511.tar.gz
Resolve - Fix a minor lookup bug around self:: paths
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/absolute.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp
index 9b75dd98..f21dc77d 100644
--- a/src/resolve/absolute.cpp
+++ b/src/resolve/absolute.cpp
@@ -1375,7 +1375,25 @@ void Resolve_Absolute_Path(/*const*/ Context& context, const Span& sp, Context::
),
(Self,
DEBUG("- Self");
- TODO(sp, "Resolve_Absolute_Path - Self-relative paths - " << path);
+ const auto& mp_nodes = context.m_mod.path().nodes();
+ // Ignore any leading anon modules
+ unsigned int start_len = mp_nodes.size();
+ while( start_len > 0 && mp_nodes[start_len-1].name()[0] == '#' )
+ start_len --;
+
+ // - Create a new path
+ ::AST::Path np("", {});
+ auto& np_nodes = np.nodes();
+ np_nodes.reserve( start_len + e.nodes.size() );
+ for(unsigned int i = 0; i < start_len; i ++ )
+ np_nodes.push_back( mp_nodes[i] );
+ for(auto& en : e.nodes)
+ np_nodes.push_back( mv$(en) );
+
+ if( !path.is_trivial() )
+ Resolve_Absolute_PathNodes(context, sp, np_nodes);
+
+ path = mv$(np);
),
(Super,
DEBUG("- Super");