Switch radix to an enum for easier formatting (#1130)

Note the use of an enum allows for the operator to be defined for formatting. This reduces the custom formatting required, which is a simplification carrying over to error handling changes I'm working on too.

Also, I kind of feel the code's now clearer about what's supported; I'm dropping CHECKs that seemed redundant with the enum.
This commit is contained in:
Jon Meow
2022-03-14 13:40:09 -07:00
committed by GitHub
parent 20b272446f
commit c6c050ccfc
3 changed files with 73 additions and 51 deletions
+1 -1
View File
@@ -252,7 +252,7 @@ class TokenizedBuffer::Lexer {
buffer_.literal_int_storage_.push_back(std::move(value.mantissa));
buffer_.literal_int_storage_.push_back(std::move(value.exponent));
CHECK(buffer_.GetRealLiteral(token).IsDecimal() ==
(value.radix == 10));
(value.radix == LexedNumericLiteral::Radix::Decimal));
return token;
},
[&](LexedNumericLiteral::UnrecoverableError) {