From 560fbd0df1f9f9ba1c9a95f1319914df8fd79278 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 13 Feb 2018 11:43:47 +0100 Subject: Always use shortened literal number representation. --- libsolidity/ast/Types.cpp | 16 ++++++++-------- libsolidity/ast/Types.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'libsolidity') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 716a1204..e4b7e4fd 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -949,25 +949,25 @@ bool RationalNumberType::operator==(Type const& _other) const return m_value == other.m_value; } -string RationalNumberType::bigintToString(dev::bigint const& _num, bool _short) +string RationalNumberType::bigintToReadableString(dev::bigint const& _num) { string str = _num.str(); - if (_short && str.size() > 32) + if (str.size() > 32) { int omitted = str.size() - 8; - return str.substr(0, 4) + "...(" + to_string(omitted) + " digits omitted)..." + str.substr(str.size() - 4, 4); + str = str.substr(0, 4) + "...(" + to_string(omitted) + " digits omitted)..." + str.substr(str.size() - 4, 4); } return str; } -string RationalNumberType::toString(bool _short) const +string RationalNumberType::toString(bool) const { if (!isFractional()) - return "int_const " + bigintToString(m_value.numerator(), _short); + return "int_const " + bigintToReadableString(m_value.numerator()); - string numerator = bigintToString(m_value.numerator(), _short); - string denominator = bigintToString(m_value.denominator(), _short); - return "rational_const " + numerator + '/' + denominator; + string numerator = bigintToReadableString(m_value.numerator()); + string denominator = bigintToReadableString(m_value.denominator()); + return "rational_const " + numerator + " / " + denominator; } u256 RationalNumberType::literalValue(Literal const*) const diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 05f23d04..2e7d05ba 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -440,7 +440,7 @@ private: /// @returns a truncated readable representation of the bigint keeping only /// up to 4 leading and 4 trailing digits. - static std::string bigintToString(dev::bigint const& num, bool _short); + static std::string bigintToReadableString(dev::bigint const& num); }; /** -- cgit v1.2.3