diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-10 16:45:38 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-10 16:45:38 +0800 |
commit | bf1c589303fc96754084a66be6d20b0a92f71357 (patch) | |
tree | 20a82e2098ac721bbc7fae121b590ab4013213aa /src/hir/dump.cpp | |
parent | efba09df1f3f513acc8db4b8f0c7bae80483af6d (diff) | |
download | mrust-bf1c589303fc96754084a66be6d20b0a92f71357.tar.gz |
HIR Dump - Cleaner output of literals
Diffstat (limited to 'src/hir/dump.cpp')
-rw-r--r-- | src/hir/dump.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/hir/dump.cpp b/src/hir/dump.cpp index e8d5c04a..5801d5c3 100644 --- a/src/hir/dump.cpp +++ b/src/hir/dump.cpp @@ -561,6 +561,14 @@ namespace { case ::HIR::CoreType::I32: m_os << static_cast<int64_t>(e.m_value) << "_i32"; break; case ::HIR::CoreType::I64: m_os << static_cast<int64_t>(e.m_value) << "_i64"; break; case ::HIR::CoreType::Isize:m_os << static_cast<int64_t>(e.m_value) << "_isize";break; + case ::HIR::CoreType::Char: + if( e.m_value == '\\' || e.m_value == '\'' ) + m_os << "'\\" << static_cast<char>(e.m_value) << "'"; + else if( ' ' <= e.m_value && e.m_value <= 0x7F ) + m_os << "'" << static_cast<char>(e.m_value) << "'"; + else + m_os << "'\\u{" << ::std::hex << e.m_value << ::std::dec << "}'"; + break; default: m_os << e.m_value << "_unk"; break; } ), |