summaryrefslogtreecommitdiff
path: root/src/resolve
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolve')
-rw-r--r--src/resolve/absolute.cpp44
-rw-r--r--src/resolve/index.cpp13
-rw-r--r--src/resolve/use.cpp3
3 files changed, 36 insertions, 24 deletions
diff --git a/src/resolve/absolute.cpp b/src/resolve/absolute.cpp
index d2609e9e..75a0857f 100644
--- a/src/resolve/absolute.cpp
+++ b/src/resolve/absolute.cpp
@@ -350,7 +350,7 @@ namespace
auto v = mod.m_value_items.find(name);
if( v != mod.m_value_items.end() ) {
const auto& b = v->second.path.m_bindings.value;
- if( const auto* be = b.opt_EnumVar() ) {
+ if( /*const auto* be =*/ b.opt_EnumVar() ) {
DEBUG("- TY: Enum variant " << v->second.path);
path = ::AST::Path( v->second.path );
return true;
@@ -832,6 +832,9 @@ namespace {
(TypeAlias,
pb.type = ::AST::PathBinding_Type::make_TypeAlias({nullptr/*, &e*/});
),
+ (ExternType,
+ pb.type = ::AST::PathBinding_Type::make_TypeAlias({nullptr/*, &e*/});
+ ),
(Struct,
pb.type = ::AST::PathBinding_Type::make_Struct({nullptr, &e});
),
@@ -880,8 +883,8 @@ namespace {
if( it == hmod->m_mod_items.end() )
ERROR(sp, E0000, "Couldn't find path component '" << n.name() << "' of " << path);
- TU_MATCH(::HIR::TypeItem, (it->second->ent), (e),
- (Import,
+ TU_MATCH_HDRA( (it->second->ent), {)
+ TU_ARMA(Import, e) {
// - Update path then restart
auto newpath = AST::Path(e.path.m_crate_name, {});
for(const auto& n : e.path.m_components)
@@ -892,11 +895,11 @@ namespace {
// TODO: Recursion limit
Resolve_Absolute_Path_BindAbsolute(context, sp, mode, path);
return ;
- ),
- (Module,
+ }
+ TU_ARMA(Module, e) {
hmod = &e;
- ),
- (Trait,
+ }
+ TU_ARMA(Trait, e) {
auto trait_path = ::AST::Path( crate.m_name, {} );
for(unsigned int j = start; j <= i; j ++)
trait_path.nodes().push_back( path_abs.nodes[j].name() );
@@ -940,23 +943,15 @@ namespace {
path = mv$(new_path);
return Resolve_Absolute_Path_BindUFCS(context, sp, mode, path);
- ),
- (TypeAlias,
- 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);
- ),
- (Struct,
- 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);
- ),
- (Union,
+ }
+ case ::HIR::TypeItem::TAG_ExternType:
+ case ::HIR::TypeItem::TAG_TypeAlias:
+ case ::HIR::TypeItem::TAG_Struct:
+ case ::HIR::TypeItem::TAG_Union:
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,
+ TU_ARMA(Enum, e) {
const auto& last_node = path_abs.nodes.back();
// If this refers to an enum variant, return the full path
auto idx = e.find_variant(last_node.name());
@@ -982,8 +977,8 @@ namespace {
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);
- )
- )
+ }
+ }
}
const auto& name = path_abs.nodes.back().name();
@@ -1007,6 +1002,9 @@ namespace {
(Module,
path.m_bindings.type = ::AST::PathBinding_Type::make_Module({nullptr, &e});
),
+ (ExternType,
+ path.m_bindings.type = ::AST::PathBinding_Type::make_TypeAlias({nullptr/*, &e*/});
+ ),
(TypeAlias,
path.m_bindings.type = ::AST::PathBinding_Type::make_TypeAlias({nullptr/*, &e*/});
),
diff --git a/src/resolve/index.cpp b/src/resolve/index.cpp
index ec1fcd8d..ddeffa0c 100644
--- a/src/resolve/index.cpp
+++ b/src/resolve/index.cpp
@@ -241,7 +241,15 @@ void Resolve_Index_Module_Base(const AST::Crate& crate, AST::Module& mod)
i.is_pub, i_data.name, mv$(path), e.mac
});
}
- // TODO: Other imports (e.g. derives, which have different naming structures)
+ TU_ARMA(ProcMacro, e) {
+ TODO(sp, "ProcMacro import");
+ }
+ TU_ARMA(ProcMacroAttribute, e) {
+ TODO(sp, "ProcMacroAttribute import");
+ }
+ TU_ARMA(ProcMacroDerive, e) {
+ TODO(sp, "ProcMacroDerive import");
+ }
}}
}
else
@@ -319,6 +327,9 @@ void Resolve_Index_Module_Wildcard__glob_in_hir_mod(const Span& sp, const AST::C
),
(TypeAlias,
p.m_bindings.type = ::AST::PathBinding_Type::make_TypeAlias({nullptr});
+ ),
+ (ExternType,
+ p.m_bindings.type = ::AST::PathBinding_Type::make_TypeAlias({nullptr});
)
)
_add_item_type( sp, dst_mod, it.first, is_pub, mv$(p), false );
diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp
index 8c9266a2..95e6d2c1 100644
--- a/src/resolve/use.cpp
+++ b/src/resolve/use.cpp
@@ -645,6 +645,9 @@ namespace {
(TypeAlias,
rv.type = ::AST::PathBinding_Type::make_TypeAlias({nullptr});
),
+ (ExternType,
+ rv.type = ::AST::PathBinding_Type::make_TypeAlias({nullptr}); // Lazy.
+ ),
(Enum,
rv.type = ::AST::PathBinding_Type::make_Enum({nullptr, &e});
),