summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-07-08 18:24:33 +1000
committerJohn Hodge <tpg@mutabah.net>2016-07-08 18:24:33 +1000
commit6822e2477bd227609dba1c7185c3366254a751f9 (patch)
tree9ec21b145661f864fe6ea4b462bd01dfae758fc2 /src
parent9c931ff72cfb12d5937f0697eba5c3728825edba (diff)
downloadmrust-6822e2477bd227609dba1c7185c3366254a751f9.tar.gz
HIR Typecheck CS - Apply ivar defaults when nothing else can be done
Diffstat (limited to 'src')
-rw-r--r--src/hir_typeck/expr_cs.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp
index a43a15e5..238b0314 100644
--- a/src/hir_typeck/expr_cs.cpp
+++ b/src/hir_typeck/expr_cs.cpp
@@ -2795,6 +2795,7 @@ namespace {
}
+
void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR::TypeRef& result_type, ::HIR::ExprPtr& expr)
{
TRACE_FUNCTION;
@@ -2924,6 +2925,21 @@ void Typecheck_Code_CS(const typeck::ModuleState& ms, t_args& args, const ::HIR:
i ++ ;
}
+
+ // Finally. If nothing changed, apply ivar defaults
+ if( !context.take_changed() )
+ {
+ DEBUG("- Applying defaults");
+ if( context.m_ivars.apply_defaults() ) {
+ context.m_ivars.mark_change();
+ }
+ }
+ else
+ {
+ // - Mark it back
+ context.m_ivars.mark_change();
+ }
+
count ++;
context.m_resolve.compact_ivars(context.m_ivars);
}