summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mir/from_hir.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index a3410d35..655591a5 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -420,12 +420,18 @@ namespace {
{
this->visit_node_ptr(node.m_value);
- if( m_builder.block_active() ) {
- this->destructure_from(node.span(), node.m_pattern, m_builder.get_result_in_lvalue(node.m_value->span(), node.m_type));
- }
- else {
+ if( ! m_builder.block_active() ) {
return ;
}
+
+ if( node.m_pattern.m_binding.is_valid() && node.m_pattern.m_data.is_Any() && node.m_pattern.m_binding.m_type == ::HIR::PatternBinding::Type::Move )
+ {
+ m_builder.push_stmt_assign( node.span(), ::MIR::LValue::make_Variable(node.m_pattern.m_binding.m_slot), m_builder.get_result(node.span()) );
+ }
+ else
+ {
+ this->destructure_from(node.span(), node.m_pattern, m_builder.get_result_in_lvalue(node.m_value->span(), node.m_type));
+ }
}
m_builder.set_result(node.span(), ::MIR::RValue::make_Tuple({}));
}