diff options
author | John Hodge <tpg@mutabah.net> | 2015-03-25 22:18:02 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-03-25 22:18:02 +0800 |
commit | bcdff39b26a01904b0a33f2bdb80bb7f6cac37f7 (patch) | |
tree | 0b1a88a6fa60deb756fd5b1fada299da2af68a8f /src | |
parent | 66880a641295734c437feb4eb32fb60bf5cd9af5 (diff) | |
download | mrust-bcdff39b26a01904b0a33f2bdb80bb7f6cac37f7.tar.gz |
Wildcard imports in Path::resolve, associated types in ast_iterate
Diffstat (limited to 'src')
-rw-r--r-- | src/ast/path.cpp | 14 | ||||
-rw-r--r-- | 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() ) |