diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-18 21:40:06 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-18 21:40:06 +0800 |
commit | c0d8141930e95f71a6d4fb84114fdc8a449527b7 (patch) | |
tree | 828892e2cbee599bc15227ba3270f6ddc82d2581 /src/mir/from_hir.cpp | |
parent | 65aba167033019994e35f43b819d8fbd3620e9ff (diff) | |
download | mrust-c0d8141930e95f71a6d4fb84114fdc8a449527b7.tar.gz |
All - Support tuple patterns with .. at the start/end - TODO: Support in the middle
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r-- | src/mir/from_hir.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index b8953fec..55ce6cb1 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -81,6 +81,7 @@ namespace { destructure_from_ex(sp, *e.sub, ::MIR::LValue::make_Deref({ box$( mv$(lval) ) }), allow_refutable); ), (Tuple, + ASSERT_BUG(sp, e.glob_pos == ::HIR::Pattern::GlobPos::None, "Tuple .. should be eliminated"); for(unsigned int i = 0; i < e.sub_patterns.size(); i ++ ) { destructure_from_ex(sp, e.sub_patterns[i], ::MIR::LValue::make_Field({ box$( lval.clone() ), i}), allow_refutable); @@ -95,9 +96,6 @@ namespace { destructure_from_ex(sp, e.sub_patterns[i], ::MIR::LValue::make_Field({ box$( lval.clone() ), i}), allow_refutable); } ), - (StructTupleWildcard, - // Nothing. - ), (Struct, const auto& str = *e.binding; const auto& fields = str.m_data.as_Named(); @@ -125,9 +123,6 @@ namespace { destructure_from_ex(sp, e.sub_patterns[i], ::MIR::LValue::make_Field({ box$( lval_var.clone() ), i}), allow_refutable); } ), - (EnumTupleWildcard, - ASSERT_BUG(sp, allow_refutable, "Refutable pattern not expected - " << pat); - ), (EnumStruct, ASSERT_BUG(sp, allow_refutable, "Refutable pattern not expected - " << pat); const auto& enm = *e.binding_ptr; |