diff options
author | John Hodge <tpg@mutabah.net> | 2016-09-29 08:58:08 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-09-29 08:58:08 +0800 |
commit | c1386b6872d4353de3a8e3494ec5bd5e0b29b7bb (patch) | |
tree | f31cc5bee6cac16cf72d5e6216a687d69097e4d8 /src | |
parent | 05b52fb51e092ed47614a5ee687819b77bb76f52 (diff) | |
download | mrust-c1386b6872d4353de3a8e3494ec5bd5e0b29b7bb.tar.gz |
HIR Typecheck Expr - Autoderef in _CallValue
Diffstat (limited to 'src')
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 2fd1feb0..86557240 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -1998,7 +1998,7 @@ namespace { no_revisit(node); } void visit(::HIR::ExprNode_CallValue& node) override { - const auto& sp = node.span(); + //const auto& sp = node.span(); const auto& ty_o = this->context.get_type(node.m_value->m_res_type); TRACE_FUNCTION_F("CallValue: ty=" << ty_o); @@ -2120,7 +2120,12 @@ namespace { if( deref_count > 0 ) { - TODO(sp, "Insert autoderef for CallValue (" << deref_count << " needed) - " << *ty_p << " and " << ty_o); + ty_p = &ty_o; + while(deref_count-- > 0) + { + ty_p = &this->context.get_type(*ty_p->m_data.as_Borrow().inner); + node.m_value = this->context.create_autoderef( mv$(node.m_value), ty_p->clone() ); + } } assert( node.m_arg_types.size() == node.m_args.size() + 1 ); |