diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-28 13:57:01 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-28 13:57:01 +0800 |
commit | 4edbe2df00354b257389e485dda544eb30a62409 (patch) | |
tree | 8e04e92ccf9b0dae61bda8a12026cc9c9c41111a /src | |
parent | 5ed0a0944d7d0c5205d78de9195765de755815bc (diff) | |
download | mrust-4edbe2df00354b257389e485dda544eb30a62409.tar.gz |
Resolve Absolute - Implement some TODOs
Diffstat (limited to 'src')
-rw-r--r-- | src/resolve/absolute.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp index 29e7fa4b..4efad8c9 100644 --- a/src/resolve/absolute.cpp +++ b/src/resolve/absolute.cpp @@ -509,6 +509,7 @@ struct Context +void Resolve_Absolute_Path_BindAbsolute(Context& context, const Span& sp, Context::LookupMode& mode, ::AST::Path& path); void Resolve_Absolute_Path(/*const*/ Context& context, const Span& sp, Context::LookupMode mode, ::AST::Path& path); void Resolve_Absolute_Type(Context& context, TypeRef& type); void Resolve_Absolute_Expr(Context& context, ::AST::Expr& expr); @@ -754,7 +755,16 @@ namespace { TU_MATCH(::HIR::TypeItem, (it->second->ent), (e), (Import, - TODO(sp, "Bind via extern use - " << path); + // - Update path then restart + auto newpath = AST::Path(e.m_crate_name, {}); + for(const auto& n : e.m_components) + newpath.nodes().push_back( AST::PathNode(n) ); + for(unsigned int j = i + 1; j < path.nodes().size(); j ++) + newpath.nodes().push_back( mv$(path.nodes()[j]) ); + path = mv$(newpath); + // TODO: Recursion limit + Resolve_Absolute_Path_BindAbsolute(context, sp, mode, path); + return ; ), (Module, hmod = &e; @@ -1067,7 +1077,15 @@ void Resolve_Absolute_Path_BindAbsolute(Context& context, const Span& sp, Contex ), (Enum, if( name_ref.is_import ) { - TODO(sp, "Replace path component with new path - " << path << "[.."<<i<<"] with " << name_ref.path); + auto newpath = name_ref.path; + for(unsigned int j = i+1; j < path_abs.nodes.size(); j ++) + { + newpath.nodes().push_back( mv$(path_abs.nodes[j]) ); + } + path = mv$(newpath); + //TOOD: Recursion limit + Resolve_Absolute_Path_BindAbsolute(context, sp, mode, path); + return ; } else { assert( e.enum_ ); |