diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-12 09:16:51 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-12 09:16:51 +0800 |
commit | c5a6ac0f58e2599c6d1d6737fc6b421bf01c95f3 (patch) | |
tree | df154862b02cfa7ee405961cc4cb68e3224a0098 /src/resolve | |
parent | 4c51f18a88d4a822b98ae173a3329b1532b45617 (diff) | |
download | mrust-c5a6ac0f58e2599c6d1d6737fc6b421bf01c95f3.tar.gz |
Resolve Use - Bind to wildcard-imported enum variants
Diffstat (limited to 'src/resolve')
-rw-r--r-- | src/resolve/use.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/resolve/use.cpp b/src/resolve/use.cpp index 95cfd3b3..31fd0734 100644 --- a/src/resolve/use.cpp +++ b/src/resolve/use.cpp @@ -400,7 +400,21 @@ void Resolve_Use_Mod(const ::AST::Crate& crate, ::AST::Module& mod, ::AST::Path } ), (Enum, - TODO(span, "Look up wildcard in enum"); + assert(e.enum_ || e.hir); + if( e.enum_ ) { + const auto& enm = *e.enum_; + unsigned int i = 0; + for(const auto& var : enm.variants()) + { + if( var.m_name == des_item_name ) { + return ::AST::PathBinding::make_EnumVar({ &enm, i }); + } + i ++; + } + } + else { + TODO(span, "Look up '" << des_item_name << "' in wildcard of enum - HIR"); + } ) ) } |