diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-29 13:26:52 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-29 13:26:52 +0800 |
commit | f5420b8174f7acf062f4c5d682820019d79cbdaf (patch) | |
tree | d6c6cdb63a0be8b754d618395d0ffa7443eb2352 /src/hir_conv/constant_evaluation.cpp | |
parent | d8fed3a1def1ae667c1471f44b19749a1f88cc42 (diff) | |
download | mrust-f5420b8174f7acf062f4c5d682820019d79cbdaf.tar.gz |
HIR Types - Store array size expr as a shared_ptr to allow cloning
Diffstat (limited to 'src/hir_conv/constant_evaluation.cpp')
-rw-r--r-- | src/hir_conv/constant_evaluation.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/hir_conv/constant_evaluation.cpp b/src/hir_conv/constant_evaluation.cpp index b362d5f9..b3e1cc9d 100644 --- a/src/hir_conv/constant_evaluation.cpp +++ b/src/hir_conv/constant_evaluation.cpp @@ -1088,10 +1088,12 @@ namespace { ::HIR::Visitor::visit_type(*e.inner); if( e.size_val == ~0u ) { - assert(e.size.get() != nullptr); - auto val = evaluate_constant(e.size->span(), m_crate, NewvalState { m_new_values, *m_mod_path, FMT("ty_" << &ty << "$") }, e.size); + assert(e.size); + assert(*e.size); + const auto& expr_ptr = *e.size; + auto val = evaluate_constant(expr_ptr->span(), m_crate, NewvalState { m_new_values, *m_mod_path, FMT("ty_" << &ty << "$") }, expr_ptr); if( !val.is_Integer() ) - ERROR(e.size->span(), E0000, "Array size isn't an integer"); + ERROR(expr_ptr->span(), E0000, "Array size isn't an integer"); e.size_val = val.as_Integer(); } DEBUG("Array " << ty << " - size = " << e.size_val); |