From 4b749fc33335cee2de50e31776ddae1f73649a7b Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Tue, 29 Mar 2016 15:08:51 -0500 Subject: changed names for Rational Constants and categories --- libsolidity/codegen/CompilerUtils.cpp | 10 +++++----- libsolidity/codegen/ExpressionCompiler.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'libsolidity/codegen') diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index 15446978..9efb2c29 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -345,11 +345,11 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp break; case Type::Category::Integer: case Type::Category::Contract: - case Type::Category::NumberConstant: + case Type::Category::RationalNumber case Type::Category::FixedPoint: if (targetTypeCategory == Type::Category::FixedBytes) { - solAssert(stackTypeCategory == Type::Category::Integer || stackTypeCategory == Type::Category::NumberConstant, + solAssert(stackTypeCategory == Type::Category::Integer || stackTypeCategory == Type::Category::RationalNumber, "Invalid conversion to FixedBytesType requested."); // conversion from bytes to string. no need to clean the high bit // only to shift left because of opposite alignment @@ -366,7 +366,7 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp { solAssert( stackTypeCategory == Type::Category::Integer || - stackTypeCategory == Type::Category::NumberConstant || + stackTypeCategory == Type::Category::RationalNumber || stackTypeCategory == Type::Category::FixedPoint, "Invalid conversion to FixedMxNType requested." ); @@ -384,9 +384,9 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp IntegerType addressType(0, IntegerType::Modifier::Address); IntegerType const& targetType = targetTypeCategory == Type::Category::Integer ? dynamic_cast(_targetType) : addressType; - if (stackTypeCategory == Type::Category::NumberConstant) + if (stackTypeCategory == Type::Category::RationalNumber) { - ConstantNumberType const& constType = dynamic_cast(_typeOnStack); + RationalNumberType const& constType = dynamic_cast(_typeOnStack); // We know that the stack is clean, we only have to clean for a narrowing conversion // where cleanup is forced. if (targetType.numBits() < constType.integerType()->numBits() && _cleanupNeeded) diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 14bc0855..baf587f0 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -285,7 +285,7 @@ bool ExpressionCompiler::visit(UnaryOperation const& _unaryOperation) // the operator should know how to convert itself and to which types it applies, so // put this code together with "Type::acceptsBinary/UnaryOperator" into a class that // represents the operator - if (_unaryOperation.annotation().type->category() == Type::Category::NumberConstant) + if (_unaryOperation.annotation().type->category() == Type::Category::RationalNumber) { m_context << _unaryOperation.annotation().type->literalValue(nullptr); return false; @@ -360,7 +360,7 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation) if (c_op == Token::And || c_op == Token::Or) // special case: short-circuiting appendAndOrOperatorCode(_binaryOperation); - else if (commonType.category() == Type::Category::NumberConstant) + else if (commonType.category() == Type::Category::RationalNumber) m_context << commonType.literalValue(nullptr); else { @@ -370,7 +370,7 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation) // for commutative operators, push the literal as late as possible to allow improved optimization auto isLiteral = [](Expression const& _e) { - return dynamic_cast(&_e) || _e.annotation().type->category() == Type::Category::NumberConstant; + return dynamic_cast(&_e) || _e.annotation().type->category() == Type::Category::RationalNumber; }; bool swap = m_optimize && Token::isCommutativeOp(c_op) && isLiteral(rightExpression) && !isLiteral(leftExpression); if (swap) @@ -1225,7 +1225,7 @@ void ExpressionCompiler::endVisit(Literal const& _literal) switch (type->category()) { - case Type::Category::NumberConstant: + case Type::Category::RationalNumber: case Type::Category::Bool: m_context << type->literalValue(&_literal); break; -- cgit