diff options
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/absolute.cpp | 18 | ||||
-rw-r--r-- | src/resolve/index.cpp | 8 | ||||
-rw-r--r-- | src/resolve/use.cpp | 7 |
3 files changed, 33 insertions, 0 deletions
diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp index 34f217a8..76da7ed1 100644 --- a/src/resolve/absolute.cpp +++ b/src/resolve/absolute.cpp @@ -766,6 +766,9 @@ namespace { (Struct, pb = ::AST::PathBinding::make_Struct({nullptr, &e}); ), + (Union, + pb = ::AST::PathBinding::make_Union({nullptr, &e}); + ), (Enum, pb = ::AST::PathBinding::make_Enum({nullptr, &e}); ) @@ -868,6 +871,12 @@ namespace { path = split_into_ufcs_ty(sp, mv$(path), i-start); return Resolve_Absolute_Path_BindUFCS(context, sp, mode, path); ), + (Union, + // TODO: set binding + path = split_into_crate(sp, mv$(path), start, crate.m_name); + path = split_into_ufcs_ty(sp, mv$(path), i-start); + return Resolve_Absolute_Path_BindUFCS(context, sp, mode, path); + ), (Enum, const auto& last_node = path_abs.nodes.back(); // If this refers to an enum variant, return the full path @@ -924,6 +933,9 @@ namespace { ), (Struct, path.bind( ::AST::PathBinding::make_Struct({nullptr, &e}) ); + ), + (Union, + path.bind( ::AST::PathBinding::make_Union({nullptr, &e}) ); ) ) // Update path (trim down to `start` and set crate name) @@ -1800,6 +1812,7 @@ void Resolve_Absolute_ImplItems(Context& item_context, ::AST::NamedList< ::AST: (Enum , BUG(i.data.span, "Resolve_Absolute_ImplItems - Enum");), (Trait , BUG(i.data.span, "Resolve_Absolute_ImplItems - Trait");), (Struct, BUG(i.data.span, "Resolve_Absolute_ImplItems - Struct");), + (Union , BUG(i.data.span, "Resolve_Absolute_ImplItems - Union");), (Type, DEBUG("Type - " << i.name); assert( e.params().ty_params().size() == 0 ); @@ -1862,6 +1875,7 @@ void Resolve_Absolute_ImplItems(Context& item_context, ::std::vector< ::AST::Im (Enum , BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), (Trait , BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), (Struct, BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), + (Union , BUG(i.data->span, "Resolve_Absolute_ImplItems - " << i.data->tag_str());), (Type, DEBUG("Type - " << i.name); assert( e.params().ty_params().size() == 0 ); @@ -2098,6 +2112,10 @@ void Resolve_Absolute_Mod( Context item_context, ::AST::Module& mod ) DEBUG("Struct - " << i.name); Resolve_Absolute_Struct(item_context, e); ), + (Union, + DEBUG("Union - " << i.name); + TODO(i.data.span, "Union"); + ), (Function, DEBUG("Function - " << i.name); Resolve_Absolute_Function(item_context, e); diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp index 09d3909b..c65327b0 100644 --- a/src/resolve/index.cpp +++ b/src/resolve/index.cpp @@ -130,6 +130,10 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod) p.bind( ::AST::PathBinding::make_Enum({&e}) ); _add_item_type(i.data.span, mod, i.name, i.is_pub, mv$(p)); ), + (Union, + p.bind( ::AST::PathBinding::make_Union({&e}) ); + _add_item_type(i.data.span, mod, i.name, i.is_pub, mv$(p)); + ), (Trait, p.bind( ::AST::PathBinding::make_Trait({&e}) ); _add_item_type(i.data.span, mod, i.name, i.is_pub, mv$(p)); @@ -194,6 +198,7 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod) (Crate , _add_item(sp, mod, IndexName::Namespace, i.name, i.is_pub, i_data.path, !allow_collide); ), (Module, _add_item(sp, mod, IndexName::Namespace, i.name, i.is_pub, i_data.path, !allow_collide); ), (Enum, _add_item_type(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); ), + (Union, _add_item_type(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); ), (Trait, _add_item_type(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); ), (TypeAlias,_add_item_type(sp, mod, i.name, i.is_pub, i_data.path, !allow_collide); ), @@ -286,6 +291,9 @@ void Resolve_Index_Module_Wildcard__glob_in_hir_mod(const Span& sp, const AST::C (Struct, p.bind( ::AST::PathBinding::make_Struct({nullptr, &e}) ); ), + (Union, + p.bind( ::AST::PathBinding::make_Union({nullptr, &e}) ); + ), (Enum, p.bind( ::AST::PathBinding::make_Enum({nullptr}) ); ), diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp index 9c5bf090..89957696 100644 --- a/src/resolve/use.cpp +++ b/src/resolve/use.cpp @@ -324,6 +324,10 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path if( allow != Lookup::Value ) return ::AST::PathBinding::make_Enum({&e}); ), + (Union, + if( allow != Lookup::Value ) + return ::AST::PathBinding::make_Union({&e}); + ), (Module, if( allow != Lookup::Value ) return ::AST::PathBinding::make_Module({&e}); @@ -591,6 +595,9 @@ namespace { (Struct, return ::AST::PathBinding::make_Struct({nullptr, &e}); ), + (Union, + return ::AST::PathBinding::make_Union({nullptr, &e}); + ), (Trait, return ::AST::PathBinding::make_Trait({nullptr, &e}); ) |