diff options
author | chriseth <chris@ethereum.org> | 2016-08-23 23:03:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-23 23:03:46 +0800 |
commit | 9a2d1a737fa8d5248e81703210151c16c3030084 (patch) | |
tree | cce63802cd78151618076cc86f14f8e22f85d801 | |
parent | de535a74cf6a0e534e0bc11fcf2c39d518011b93 (diff) | |
parent | 345c0f36fb63990b27ddd9c82385a60b2276bd04 (diff) | |
download | dexon-solidity-9a2d1a737fa8d5248e81703210151c16c3030084.tar dexon-solidity-9a2d1a737fa8d5248e81703210151c16c3030084.tar.gz dexon-solidity-9a2d1a737fa8d5248e81703210151c16c3030084.tar.bz2 dexon-solidity-9a2d1a737fa8d5248e81703210151c16c3030084.tar.lz dexon-solidity-9a2d1a737fa8d5248e81703210151c16c3030084.tar.xz dexon-solidity-9a2d1a737fa8d5248e81703210151c16c3030084.tar.zst dexon-solidity-9a2d1a737fa8d5248e81703210151c16c3030084.zip |
Merge pull request #936 from chriseth/fixFormalExp
Fix crash when using json compiler with exponentiation.
-rw-r--r-- | libsolidity/formal/Why3Translator.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libsolidity/formal/Why3Translator.cpp b/libsolidity/formal/Why3Translator.cpp index bd0a020d..e16c41ab 100644 --- a/libsolidity/formal/Why3Translator.cpp +++ b/libsolidity/formal/Why3Translator.cpp @@ -466,7 +466,8 @@ bool Why3Translator::visit(BinaryOperation const& _binaryOperation) auto const& constantNumber = dynamic_cast<RationalNumberType const&>(commonType); if (constantNumber.isFractional()) error(_binaryOperation, "Fractional numbers not supported."); - add("(of_int " + toString(commonType.literalValue(nullptr)) + ")"); + else + add("(of_int " + toString(commonType.literalValue(nullptr)) + ")"); return false; } static const map<Token::Value, char const*> optrans({ @@ -488,7 +489,10 @@ bool Why3Translator::visit(BinaryOperation const& _binaryOperation) {Token::GreaterThanOrEqual, " >= "} }); if (!optrans.count(c_op)) + { error(_binaryOperation, "Operator not supported."); + return true; + } add("("); leftExpression.accept(*this); @@ -676,7 +680,8 @@ bool Why3Translator::visit(Literal const& _literal) auto const& constantNumber = dynamic_cast<RationalNumberType const&>(*type); if (constantNumber.isFractional()) error(_literal, "Fractional numbers not supported."); - add("(of_int " + toString(type->literalValue(&_literal)) + ")"); + else + add("(of_int " + toString(type->literalValue(&_literal)) + ")"); break; } default: |