summaryrefslogtreecommitdiff
path: root/src/resolve/absolute.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-10-31 10:01:41 +0800
committerJohn Hodge <tpg@mutabah.net>2016-10-31 10:01:41 +0800
commitfc7239e7271e879102272ea4d7e98f87f027ee84 (patch)
tree8134b59f26d6901b0eefc7709bb4ad40afda7f11 /src/resolve/absolute.cpp
parentea043a43eeff8512396afc166ca1d0085873c57d (diff)
downloadmrust-fc7239e7271e879102272ea4d7e98f87f027ee84.tar.gz
All - Rough support for `union` (data structure present in all stages)
Diffstat (limited to 'src/resolve/absolute.cpp')
-rw-r--r--src/resolve/absolute.cpp18
1 files changed, 18 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);