diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-19 11:16:26 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-19 11:16:26 +0800 |
commit | 482a2ef80fed80d860522046c5b1e0466b6b8eb0 (patch) | |
tree | 21702ee7060a1d49e96bbe61ecde9ccebdbe867d /src/mir/from_hir.cpp | |
parent | 9e88045cd45d4ccdb121c0bc8996fc20cc273416 (diff) | |
download | mrust-482a2ef80fed80d860522046c5b1e0466b6b8eb0.tar.gz |
MIR Gen Match - Some hackarounds
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r-- | src/mir/from_hir.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index 670acf24..4a4b84e7 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -69,7 +69,10 @@ namespace { } ), (SplitTuple, - BUG(sp, "Tuple .. should be eliminated"); + for(unsigned int i = 0; i < e.leading.size(); i ++ ) + define_vars_from(sp, e.leading[i]); + for(unsigned int i = 0; i < e.trailing.size(); i ++ ) + define_vars_from(sp, e.trailing[i]); ), (StructValue, // Nothing. @@ -180,7 +183,14 @@ namespace { } ), (SplitTuple, - BUG(sp, "Tuple .. should be eliminated"); + for(unsigned int i = 0; i < e.leading.size(); i ++ ) + { + destructure_from_ex(sp, e.leading[i], ::MIR::LValue::make_Field({ box$( lval.clone() ), i}), allow_refutable); + } + for(unsigned int i = 0; i < e.trailing.size(); i ++ ) + { + destructure_from_ex(sp, e.trailing[i], ::MIR::LValue::make_Field({ box$( lval.clone() ), i}), allow_refutable); + } ), (StructValue, // Nothing. |