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 +++++++++++++- src/convert/ast_iterate.cpp | 7 ++++++- 2 files changed, 19 insertions(+), 2 deletions(-) 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 { diff --git a/src/convert/ast_iterate.cpp b/src/convert/ast_iterate.cpp index b474a755..3e92e410 100644 --- a/src/convert/ast_iterate.cpp +++ b/src/convert/ast_iterate.cpp @@ -282,7 +282,12 @@ void CASTIterator::handle_impl(AST::Path modpath, AST::Impl& impl) local_type("Self", impl.type()); - // TODO: Associated types + // Associated types + for( auto& at : impl.types() ) + { + DEBUG("- Type '" << at.name << "'"); + handle_type( at.data ); + } // Functions for( auto& fcn : impl.functions() ) -- cgit v1.2.3