summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-28 18:34:53 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-28 18:34:53 +0800
commit9a1bacab4fdb2a98ffe1e7a32a5b00effc8bd01a (patch)
tree8f47a981cbbc419b31b77ae4c1cc473e5e20c411
parent93f81a5e8fb13fd08a39026555754bd0cbb43fd7 (diff)
downloadmrust-9a1bacab4fdb2a98ffe1e7a32a5b00effc8bd01a.tar.gz
Resolve Absolute - Fix bindings for HIR imports
-rw-r--r--src/resolve/absolute.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp
index 7273f88b..01b18c00 100644
--- a/src/resolve/absolute.cpp
+++ b/src/resolve/absolute.cpp
@@ -722,10 +722,27 @@ namespace {
auto it = hmod->m_value_items.find(name);
if( it == hmod->m_value_items.end() )
ERROR(sp, E0000, "Couldn't find final component of " << p);
- if( it->second->ent.is_Import() ) {
- // Wait? is this valid?
+ TU_MATCH(::HIR::ValueItem, (it->second->ent), (e),
+ (Import,
+ // Wait? is this even valid?
TODO(sp, "HIR Import item pointed to an import");
- }
+ ),
+ (Constant,
+ pb = ::AST::PathBinding::make_Static({nullptr, nullptr});
+ ),
+ (Static,
+ pb = ::AST::PathBinding::make_Static({nullptr, &e});
+ ),
+ (StructConstant,
+ pb = ::AST::PathBinding::make_Struct({nullptr, &ext_crate.m_hir->get_typeitem_by_path(sp, e.ty, true).as_Struct()});
+ ),
+ (Function,
+ pb = ::AST::PathBinding::make_Function({nullptr/*, &e*/});
+ ),
+ (StructConstructor,
+ pb = ::AST::PathBinding::make_Struct({nullptr, &ext_crate.m_hir->get_typeitem_by_path(sp, e.ty, true).as_Struct()});
+ )
+ )
}
else
{
@@ -744,10 +761,13 @@ namespace {
pb = ::AST::PathBinding::make_Trait({nullptr, &e});
),
(TypeAlias,
+ pb = ::AST::PathBinding::make_TypeAlias({nullptr/*, &e*/});
),
(Struct,
+ pb = ::AST::PathBinding::make_Struct({nullptr, &e});
),
(Enum,
+ pb = ::AST::PathBinding::make_Enum({nullptr, &e});
)
)
}