mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #936 from chriseth/fixFormalExp
Fix crash when using json compiler with exponentiation.
This commit is contained in:
commit
9a2d1a737f
@ -466,6 +466,7 @@ bool Why3Translator::visit(BinaryOperation const& _binaryOperation)
|
|||||||
auto const& constantNumber = dynamic_cast<RationalNumberType const&>(commonType);
|
auto const& constantNumber = dynamic_cast<RationalNumberType const&>(commonType);
|
||||||
if (constantNumber.isFractional())
|
if (constantNumber.isFractional())
|
||||||
error(_binaryOperation, "Fractional numbers not supported.");
|
error(_binaryOperation, "Fractional numbers not supported.");
|
||||||
|
else
|
||||||
add("(of_int " + toString(commonType.literalValue(nullptr)) + ")");
|
add("(of_int " + toString(commonType.literalValue(nullptr)) + ")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -488,7 +489,10 @@ bool Why3Translator::visit(BinaryOperation const& _binaryOperation)
|
|||||||
{Token::GreaterThanOrEqual, " >= "}
|
{Token::GreaterThanOrEqual, " >= "}
|
||||||
});
|
});
|
||||||
if (!optrans.count(c_op))
|
if (!optrans.count(c_op))
|
||||||
|
{
|
||||||
error(_binaryOperation, "Operator not supported.");
|
error(_binaryOperation, "Operator not supported.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
add("(");
|
add("(");
|
||||||
leftExpression.accept(*this);
|
leftExpression.accept(*this);
|
||||||
@ -676,6 +680,7 @@ bool Why3Translator::visit(Literal const& _literal)
|
|||||||
auto const& constantNumber = dynamic_cast<RationalNumberType const&>(*type);
|
auto const& constantNumber = dynamic_cast<RationalNumberType const&>(*type);
|
||||||
if (constantNumber.isFractional())
|
if (constantNumber.isFractional())
|
||||||
error(_literal, "Fractional numbers not supported.");
|
error(_literal, "Fractional numbers not supported.");
|
||||||
|
else
|
||||||
add("(of_int " + toString(type->literalValue(&_literal)) + ")");
|
add("(of_int " + toString(type->literalValue(&_literal)) + ")");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user