diff options
author | John Hodge (bugs) <tpg@mutabah.net> | 2017-06-04 21:23:24 +0800 |
---|---|---|
committer | John Hodge (bugs) <tpg@mutabah.net> | 2017-06-04 21:23:24 +0800 |
commit | 83dbb728f62306d2e43b2688dd0f2d320fd5b038 (patch) | |
tree | a064267bdf8d0455ed725140abfcbed3e04b2d4a /src/resolve | |
parent | 0b9fd0014c8f32ecf299dae2ad1811dfb484af46 (diff) | |
parent | f19c75571c48588fb3816e8eb5b96f03474fbdf5 (diff) | |
download | mrust-83dbb728f62306d2e43b2688dd0f2d320fd5b038.tar.gz |
Merge branch 'master' of https://github.com/thepowersgang/mrustc
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/absolute.cpp | 4 | ||||
-rw-r--r-- | src/resolve/index.cpp | 14 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp index db85ed3f..26a45a1e 100644 --- a/src/resolve/absolute.cpp +++ b/src/resolve/absolute.cpp @@ -1020,7 +1020,7 @@ namespace { } break; } - ERROR(sp, E0000, "Couldn't find path component '" << path_abs.nodes.back().name() << "' of " << path); + ERROR(sp, E0000, "Couldn't find " << Context::lookup_mode_msg(mode) << " '" << path_abs.nodes.back().name() << "' of " << path); } } @@ -1946,6 +1946,8 @@ void Resolve_Absolute_Struct(Context& item_context, ::AST::Struct& e) Resolve_Absolute_Generic(item_context, e.params()); TU_MATCH(::AST::StructData, (e.m_data), (s), + (Unit, + ), (Tuple, for(auto& field : s.ents) { Resolve_Absolute_Type(item_context, field.m_type); diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp index 7b988bc0..f57fc3e6 100644 --- a/src/resolve/index.cpp +++ b/src/resolve/index.cpp @@ -149,7 +149,7 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod) (Struct, p.bind( ::AST::PathBinding::make_Struct({&e}) ); // - If the struct is a tuple-like struct (or unit-like), it presents in the value namespace - if( e.m_data.is_Tuple() ) { + if( ! e.m_data.is_Struct() ) { _add_item_value(i.data.span, mod, i.name, i.is_pub, p); } _add_item_type(i.data.span, mod, i.name, i.is_pub, mv$(p)); @@ -209,15 +209,9 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod) _add_item_type(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); // - If the struct is a tuple-like struct, it presents in the value namespace assert(e.struct_ || e.hir); - if( e.struct_ ) { - if( e.struct_->m_data.is_Tuple() ) { - _add_item_value(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); - } - } - else { - if( ! e.hir->m_data.is_Named() ) { - _add_item_value(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); - } + if( !(e.struct_ ? e.struct_->m_data.is_Struct() : e.hir->m_data.is_Named()) ) + { + _add_item_value(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); } ), (Static , _add_item_value(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); ), |