diff options
author | John Hodge <tpg@mutabah.net> | 2016-05-01 20:44:57 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-05-01 20:44:57 +0800 |
commit | 8863535ad350137189fcafce1343765500bc445a (patch) | |
tree | f13c723f1377599ac867d56c721ab89832607f97 /src/resolve | |
parent | 58036edfc5e36e9463147b6984c99a5094882881 (diff) | |
download | mrust-8863535ad350137189fcafce1343765500bc445a.tar.gz |
Fix handling of tuple/unit structs
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/absolute.cpp | 8 | ||||
-rw-r--r-- | src/resolve/index.cpp | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp index 19d8d53d..0fe9fe8e 100644 --- a/src/resolve/absolute.cpp +++ b/src/resolve/absolute.cpp @@ -229,7 +229,7 @@ void Resolve_Absolute_Path(const Context& context, const Span& sp, bool is_type, if(e.nodes.size() > 1 || is_type) { // Look up type auto p = context.lookup_type(sp, e.nodes[0].name()); - DEBUG("Found - " << p); + DEBUG("Found type/mod - " << p); path = mv$(p); } else { @@ -501,7 +501,7 @@ void Resolve_Absolute_Pattern(Context& context, bool allow_refutable, ::AST::Pa void Resolve_Absolute_ImplItems(Context& item_context, ::AST::NamedList< ::AST::Item >& items) { - TRACE_FUNCTION_F("()"); + TRACE_FUNCTION_F(""); for(auto& i : items) { TU_MATCH(AST::Item, (i.data), (e), @@ -513,8 +513,10 @@ void Resolve_Absolute_ImplItems(Context& item_context, ::AST::NamedList< ::AST: (Struct, BUG(Span(), "Resolve_Absolute_ImplItems - Struct");), (Type, DEBUG("Type - " << i.name); + assert( e.params().ty_params().size() == 0 ); + assert( e.params().lft_params().size() == 0 ); //item_context.push( e.params(), GenericSlot::Level::Method ); - //Resolve_Absolute_Generic(item_context, e.params()); + Resolve_Absolute_Generic(item_context, e.params()); Resolve_Absolute_Type( item_context, e.type() ); diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp index b5fdbf33..e905de26 100644 --- a/src/resolve/index.cpp +++ b/src/resolve/index.cpp @@ -107,6 +107,10 @@ void Resolve_Index_Module_Base(AST::Module& mod) (Struct, _add_item_type(mod, i.name, i.is_pub, b.clone()); + // - If the struct is a tuple-like struct, it presents in the value namespace + if( e.struct_->m_data.is_Tuple() ) { + _add_item_value(mod, i.name, i.is_pub, b.clone()); + } ), (Static , _add_item_value(mod, i.name, i.is_pub, b.clone()); ), (Function, _add_item_value(mod, i.name, i.is_pub, b.clone()); ), |