diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-27 14:50:03 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-27 14:50:03 +0800 |
commit | 12eed21f60917924cf19a10254e6c836f430b2ca (patch) | |
tree | e245a84ebc8ebc243539e19d0569ef19ace3b9c9 | |
parent | 4e9d392a6db70d13cf416848c0a8744044cf4e95 (diff) | |
download | mrust-12eed21f60917924cf19a10254e6c836f430b2ca.tar.gz |
HIR Typecheck Expr - Reorder some revisit registrations for efficiency
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 8c498220..f1a0e4ef 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -947,10 +947,10 @@ namespace { TRACE_FUNCTION_F(&node << " ... as " << node.m_res_type); this->context.add_ivars( node.m_value->m_res_type ); + node.m_value->visit( *this ); + // TODO: Only revisit if the cast type requires inferring. this->context.add_revisit(node); - - node.m_value->visit( *this ); } void visit(::HIR::ExprNode_Unsize& node) override { @@ -964,10 +964,10 @@ namespace { this->context.add_ivars( node.m_value->m_res_type ); this->context.add_ivars( node.m_index->m_res_type ); - this->context.add_revisit(node); - node.m_value->visit( *this ); node.m_index->visit( *this ); + + this->context.add_revisit(node); } void visit(::HIR::ExprNode_Deref& node) override { @@ -975,10 +975,10 @@ namespace { TRACE_FUNCTION_F(&node << " *..."); this->context.add_ivars( node.m_value->m_res_type ); - - this->context.add_revisit(node); node.m_value->visit( *this ); + + this->context.add_revisit(node); } void visit(::HIR::ExprNode_Emplace& node) override { @@ -1319,9 +1319,6 @@ namespace { this->context.add_ivars( val->m_res_type ); node.m_arg_ivars.push_back( this->context.m_ivars.new_ivar_tr() ); } - - // Nothing can be done until type is known - this->context.add_revisit(node); { auto _ = this->push_inner_coerce_scoped(false); @@ -1334,6 +1331,9 @@ namespace { this->context.equate_types_coerce(val->span(), node.m_arg_ivars[i], val); val->visit( *this ); } + + // Nothing can be done until type is known + this->context.add_revisit(node); } void visit(::HIR::ExprNode_CallMethod& node) override { |