diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-14 22:09:22 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-14 22:09:22 +0800 |
commit | 4dfe5c315498ef816baa3c62e36bc0d72cff50a9 (patch) | |
tree | aae657d43c099d1709f24931f6185c9a59b73be2 /src/hir_expand/annotate_value_usage.cpp | |
parent | 6f390a1f245d467ef8f2aa7c9e0ad7b300a4e681 (diff) | |
download | mrust-4dfe5c315498ef816baa3c62e36bc0d72cff50a9.tar.gz |
HIR - Move borrow ops to their own node type
Diffstat (limited to 'src/hir_expand/annotate_value_usage.cpp')
-rw-r--r-- | src/hir_expand/annotate_value_usage.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/hir_expand/annotate_value_usage.cpp b/src/hir_expand/annotate_value_usage.cpp index ea560bbc..eec4fd86 100644 --- a/src/hir_expand/annotate_value_usage.cpp +++ b/src/hir_expand/annotate_value_usage.cpp @@ -149,18 +149,25 @@ namespace { } void visit(::HIR::ExprNode_UniOp& node) override { - switch(node.m_op) + m_usage.push_back( ::HIR::ValueUsage::Move ); + + this->visit_node_ptr(node.m_value); + + m_usage.pop_back(); + } + void visit(::HIR::ExprNode_Borrow& node) override + { + switch(node.m_type) { - case ::HIR::ExprNode_UniOp::Op::Invert: - case ::HIR::ExprNode_UniOp::Op::Negate: - m_usage.push_back( ::HIR::ValueUsage::Move ); - break; - case ::HIR::ExprNode_UniOp::Op::Ref: + case ::HIR::BorrowType::Shared: m_usage.push_back( ::HIR::ValueUsage::Borrow ); break; - case ::HIR::ExprNode_UniOp::Op::RefMut: + case ::HIR::BorrowType::Unique: m_usage.push_back( ::HIR::ValueUsage::Mutate ); break; + case ::HIR::BorrowType::Owned: + m_usage.push_back( ::HIR::ValueUsage::Move ); + break; } this->visit_node_ptr(node.m_value); |