From dde87de4cf3d2e0cae8f8bc81e3208a9ff1ca645 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 15 Mar 2017 12:50:34 +0000 Subject: Rename x to value --- libsolidity/ast/Types.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 52d61d13..71528bbd 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -574,7 +574,7 @@ TypePointer FixedPointType::binaryOperatorResult(Token::Value _operator, TypePoi tuple RationalNumberType::isValidLiteral(Literal const& _literal) { - rational x; + rational value; try { auto expPoint = find(_literal.value().begin(), _literal.value().end(), 'e'); @@ -585,7 +585,7 @@ tuple RationalNumberType::isValidLiteral(Literal const& _literal if (boost::starts_with(_literal.value(), "0x")) { // process as hex - x = bigint(_literal.value()); + value = bigint(_literal.value()); } else if (expPoint != _literal.value().end()) { @@ -599,17 +599,18 @@ tuple RationalNumberType::isValidLiteral(Literal const& _literal if (exp > numeric_limits::max() || exp < numeric_limits::min()) return make_tuple(false, rational(0)); - x = bigint(string(_literal.value().begin(), expPoint)); + value = bigint(string(_literal.value().begin(), expPoint)); + if (exp < 0) { exp *= -1; - x /= boost::multiprecision::pow( + value /= boost::multiprecision::pow( bigint(10), exp.convert_to() ); } else - x *= boost::multiprecision::pow( + value *= boost::multiprecision::pow( bigint(10), exp.convert_to() ); @@ -637,10 +638,10 @@ tuple RationalNumberType::isValidLiteral(Literal const& _literal distance(radixPoint + 1, _literal.value().end()) ); numerator = bigint(string(_literal.value().begin(), radixPoint)); - x = numerator + denominator; + value = numerator + denominator; } else - x = bigint(_literal.value()); + value = bigint(_literal.value()); } catch (...) { @@ -653,33 +654,33 @@ tuple RationalNumberType::isValidLiteral(Literal const& _literal case Literal::SubDenomination::Second: break; case Literal::SubDenomination::Szabo: - x *= bigint("1000000000000"); + value *= bigint("1000000000000"); break; case Literal::SubDenomination::Finney: - x *= bigint("1000000000000000"); + value *= bigint("1000000000000000"); break; case Literal::SubDenomination::Ether: - x *= bigint("1000000000000000000"); + value *= bigint("1000000000000000000"); break; case Literal::SubDenomination::Minute: - x *= bigint("60"); + value *= bigint("60"); break; case Literal::SubDenomination::Hour: - x *= bigint("3600"); + value *= bigint("3600"); break; case Literal::SubDenomination::Day: - x *= bigint("86400"); + value *= bigint("86400"); break; case Literal::SubDenomination::Week: - x *= bigint("604800"); + value *= bigint("604800"); break; case Literal::SubDenomination::Year: - x *= bigint("31536000"); + value *= bigint("31536000"); break; } - return make_tuple(true, x); + return make_tuple(true, value); } bool RationalNumberType::isImplicitlyConvertibleTo(Type const& _convertTo) const -- cgit