diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-08 15:17:09 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-08 15:17:09 +0800 |
commit | 5be815dca4df26239a338cc127c9181a4cdf0de7 (patch) | |
tree | c13461346870af19010a60d2fccda1fa023a6520 | |
parent | 7fe7a219b3aa885e32c3cb0c1b131ea3ef7ca16d (diff) | |
download | mrust-5be815dca4df26239a338cc127c9181a4cdf0de7.tar.gz |
HIR Const Eval - MIR Constant::Const
-rw-r--r-- | src/hir_conv/constant_evaluation.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/hir_conv/constant_evaluation.cpp b/src/hir_conv/constant_evaluation.cpp index 412ae2d3..72c7eb34 100644 --- a/src/hir_conv/constant_evaluation.cpp +++ b/src/hir_conv/constant_evaluation.cpp @@ -619,6 +619,9 @@ namespace { ( ERROR(sp, E0000, "Field access on invalid type - " << m_rv_type); ), + (Path, + TODO(sp, "Field access on path type - " << m_rv_type); + ), (Tuple, unsigned int idx = ::std::atoi( node.m_field.c_str() ); ASSERT_BUG(sp, idx < e.size(), "Index out of range in tuple"); @@ -941,7 +944,9 @@ namespace { val = ::HIR::Literal(e2); ), (Const, - TODO(sp, "Constant::Const - " << e); + auto ent = get_ent_fullpath(sp, crate, e2.p, EntNS::Value); + ASSERT_BUG(sp, ent.is_Constant(), "MIR Constant::Const("<<e2.p<<") didn't point to a Constant - " << ent.tag_str()); + val = clone_literal( ent.as_Constant()->m_value_res ); ), (ItemAddr, val = ::HIR::Literal::make_BorrowOf( e2.clone() ); |