diff options
author | John Hodge <tpg@mutabah.net> | 2019-11-09 21:09:29 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2019-11-09 21:09:29 +0800 |
commit | 76e18750da25fd5617009e5864bdd4461fcbf982 (patch) | |
tree | 5c35b9f3a87ff4f90d6e2a9ebbbd177357c60c4b | |
parent | 6d1213a9cd039b68d9826de0a7f9204e101e6624 (diff) | |
download | mrust-76e18750da25fd5617009e5864bdd4461fcbf982.tar.gz |
HIR Expand Types - (minor) Replace TU_IFLET with a plain if
-rw-r--r-- | src/hir_conv/expand_type.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/hir_conv/expand_type.cpp b/src/hir_conv/expand_type.cpp index 2dfffb73..3b720198 100644 --- a/src/hir_conv/expand_type.cpp +++ b/src/hir_conv/expand_type.cpp @@ -112,21 +112,23 @@ public: } } - TU_IFLET(::HIR::TypeRef::Data, (ty.m_data), Path, (e), - ::HIR::TypeRef new_type = ConvertHIR_ExpandAliases_GetExpansion(m_crate, e.path, m_in_expr); + if( const auto* e = ty.m_data.opt_Path() ) + { + ::HIR::TypeRef new_type = ConvertHIR_ExpandAliases_GetExpansion(m_crate, e->path, m_in_expr); // Keep trying to expand down the chain unsigned int num_exp = 1; const unsigned int MAX_RECURSIVE_TYPE_EXPANSIONS = 100; while(num_exp < MAX_RECURSIVE_TYPE_EXPANSIONS) { ::HIR::Visitor::visit_type(new_type); - TU_IFLET(::HIR::TypeRef::Data, (new_type.m_data), Path, (e), - auto nt = ConvertHIR_ExpandAliases_GetExpansion(m_crate, e.path, m_in_expr); + if( const auto* e = new_type.m_data.opt_Path() ) + { + auto nt = ConvertHIR_ExpandAliases_GetExpansion(m_crate, e->path, m_in_expr); if( nt == ::HIR::TypeRef() ) break; num_exp ++; new_type = mv$(nt); - ) + } else { break; } @@ -136,7 +138,7 @@ public: DEBUG("Replacing " << ty << " with " << new_type << " (" << num_exp << " expansions)"); ty = mv$(new_type); } - ) + } } |