From bcdff39b26a01904b0a33f2bdb80bb7f6cac37f7 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 25 Mar 2015 22:18:02 +0800 Subject: Wildcard imports in Path::resolve, associated types in ast_iterate --- src/ast/path.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/ast/path.cpp') diff --git a/src/ast/path.cpp b/src/ast/path.cpp index 4cf74368..fed46d0c 100644 --- a/src/ast/path.cpp +++ b/src/ast/path.cpp @@ -246,7 +246,19 @@ void Path::resolve(const Crate& root_crate) const auto& imp = item.unwrap_Use(); if( imp.name == "" ) { - throw ParseError::Todo("Path::resolve - wildcard import"); + // Replace nodes 0:i-1 with source path, then recurse + AST::Path newpath = imp.data; + for( unsigned int j = i; j < m_nodes.size(); j ++ ) + { + newpath.m_nodes.push_back( m_nodes[j] ); + } + + DEBUG("- newpath = " << newpath); + // TODO: This should check for recursion somehow + newpath.resolve(root_crate); + + *this = newpath; + DEBUG("Alias resolved, *this = " << *this); } else { -- cgit v1.2.3