diff options
author | John Hodge <tpg@mutabah.net> | 2016-11-05 14:42:39 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-11-05 14:42:39 +0800 |
commit | f0f1cabbc4575f56dc6e4f62f1003e743911ca00 (patch) | |
tree | d9c133d2753c170542c1a764c720fdf0f3029f51 | |
parent | 2ccafb09cae0602d21bff6668eda7a1651a72f4f (diff) | |
download | mrust-f0f1cabbc4575f56dc6e4f62f1003e743911ca00.tar.gz |
HIR Serialise - Better errors
-rw-r--r-- | src/hir/deserialise.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hir/deserialise.cpp b/src/hir/deserialise.cpp index 3cbf442b..5eeffdb9 100644 --- a/src/hir/deserialise.cpp +++ b/src/hir/deserialise.cpp @@ -298,7 +298,7 @@ namespace { } ::MIR::LValue deserialise_mir_lvalue_() { - switch( m_in.read_tag() ) + switch(auto tag = m_in.read_tag()) { #define _(x, ...) case ::MIR::LValue::TAG_##x: return ::MIR::LValue::make_##x( __VA_ARGS__ ); _(Variable, static_cast<unsigned int>(m_in.read_count()) ) @@ -321,7 +321,7 @@ namespace { } ) #undef _ default: - throw ""; + throw ::std::runtime_error(FMT("Invalid MIR LValue tag - " << tag)); } } ::MIR::RValue deserialise_mir_rvalue() @@ -581,7 +581,7 @@ namespace { ::HIR::TypeRef HirDeserialiser::deserialise_type() { TRACE_FUNCTION; - switch( m_in.read_tag() ) + switch( auto tag = m_in.read_tag() ) { #define _(x, ...) case ::HIR::TypeRef::Data::TAG_##x: DEBUG("- "#x); return ::HIR::TypeRef( ::HIR::TypeRef::Data::make_##x( __VA_ARGS__ ) ); _(Infer, {}) @@ -629,7 +629,7 @@ namespace { }) #undef _ default: - assert(!"Bad TypeRef tag"); + throw ::std::runtime_error(FMT("Bad TypeRef tag - " << tag)); } } |