mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
rational renaming
This commit is contained in:
parent
4b749fc333
commit
f67bfd24a3
@ -31,7 +31,7 @@ using namespace dev::solidity;
|
|||||||
void ConstantEvaluator::endVisit(UnaryOperation const& _operation)
|
void ConstantEvaluator::endVisit(UnaryOperation const& _operation)
|
||||||
{
|
{
|
||||||
TypePointer const& subType = _operation.subExpression().annotation().type;
|
TypePointer const& subType = _operation.subExpression().annotation().type;
|
||||||
if (!dynamic_cast<ConstantNumberType const*>(subType.get()))
|
if (!dynamic_cast<RationalNumberType const*>(subType.get()))
|
||||||
BOOST_THROW_EXCEPTION(_operation.subExpression().createTypeError("Invalid constant expression."));
|
BOOST_THROW_EXCEPTION(_operation.subExpression().createTypeError("Invalid constant expression."));
|
||||||
TypePointer t = subType->unaryOperatorResult(_operation.getOperator());
|
TypePointer t = subType->unaryOperatorResult(_operation.getOperator());
|
||||||
_operation.annotation().type = t;
|
_operation.annotation().type = t;
|
||||||
@ -41,9 +41,9 @@ void ConstantEvaluator::endVisit(BinaryOperation const& _operation)
|
|||||||
{
|
{
|
||||||
TypePointer const& leftType = _operation.leftExpression().annotation().type;
|
TypePointer const& leftType = _operation.leftExpression().annotation().type;
|
||||||
TypePointer const& rightType = _operation.rightExpression().annotation().type;
|
TypePointer const& rightType = _operation.rightExpression().annotation().type;
|
||||||
if (!dynamic_cast<ConstantNumberType const*>(leftType.get()))
|
if (!dynamic_cast<RationalNumberType const*>(leftType.get()))
|
||||||
BOOST_THROW_EXCEPTION(_operation.leftExpression().createTypeError("Invalid constant expression."));
|
BOOST_THROW_EXCEPTION(_operation.leftExpression().createTypeError("Invalid constant expression."));
|
||||||
if (!dynamic_cast<ConstantNumberType const*>(rightType.get()))
|
if (!dynamic_cast<RationalNumberType const*>(rightType.get()))
|
||||||
BOOST_THROW_EXCEPTION(_operation.rightExpression().createTypeError("Invalid constant expression."));
|
BOOST_THROW_EXCEPTION(_operation.rightExpression().createTypeError("Invalid constant expression."));
|
||||||
TypePointer commonType = leftType->binaryOperatorResult(_operation.getOperator(), rightType);
|
TypePointer commonType = leftType->binaryOperatorResult(_operation.getOperator(), rightType);
|
||||||
if (Token::isCompareOp(_operation.getOperator()))
|
if (Token::isCompareOp(_operation.getOperator()))
|
||||||
|
@ -103,7 +103,7 @@ void ReferencesResolver::endVisit(ArrayTypeName const& _typeName)
|
|||||||
{
|
{
|
||||||
if (!length->annotation().type)
|
if (!length->annotation().type)
|
||||||
ConstantEvaluator e(*length);
|
ConstantEvaluator e(*length);
|
||||||
auto const* lengthType = dynamic_cast<ConstantNumberType const*>(length->annotation().type.get());
|
auto const* lengthType = dynamic_cast<RationalNumberType const*>(length->annotation().type.get());
|
||||||
if (!lengthType)
|
if (!lengthType)
|
||||||
fatalTypeError(length->location(), "Invalid array length.");
|
fatalTypeError(length->location(), "Invalid array length.");
|
||||||
else if (lengthType->denominator() != 1)
|
else if (lengthType->denominator() != 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user