aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-02-13 18:43:47 +0800
committerchriseth <chris@ethereum.org>2018-02-13 18:43:47 +0800
commit560fbd0df1f9f9ba1c9a95f1319914df8fd79278 (patch)
tree223ec880cbd7d2c0ec45d8b905525094f68d0a35 /libsolidity
parenta320ffeafd62b349f6143ceb6b44547c746b08bc (diff)
downloaddexon-solidity-560fbd0df1f9f9ba1c9a95f1319914df8fd79278.tar
dexon-solidity-560fbd0df1f9f9ba1c9a95f1319914df8fd79278.tar.gz
dexon-solidity-560fbd0df1f9f9ba1c9a95f1319914df8fd79278.tar.bz2
dexon-solidity-560fbd0df1f9f9ba1c9a95f1319914df8fd79278.tar.lz
dexon-solidity-560fbd0df1f9f9ba1c9a95f1319914df8fd79278.tar.xz
dexon-solidity-560fbd0df1f9f9ba1c9a95f1319914df8fd79278.tar.zst
dexon-solidity-560fbd0df1f9f9ba1c9a95f1319914df8fd79278.zip
Always use shortened literal number representation.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/ast/Types.cpp16
-rw-r--r--libsolidity/ast/Types.h2
2 files changed, 9 insertions, 9 deletions
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);
};
/**