aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGav Wood <g@ethdev.com>2015-07-15 00:16:54 +0800
committerGav Wood <g@ethdev.com>2015-07-15 00:16:54 +0800
commita85c5bd0b0bc02d36a26ef5b3ba57cde4ddb0221 (patch)
treeae90820d5d06514474cd70d387ece9b85ee6f4b6
parent73275e18250954431c58323a2d678409b0824568 (diff)
parenta3dace66e17968450322da6d84b5081c9cf56f98 (diff)
downloaddexon-solidity-a85c5bd0b0bc02d36a26ef5b3ba57cde4ddb0221.tar
dexon-solidity-a85c5bd0b0bc02d36a26ef5b3ba57cde4ddb0221.tar.gz
dexon-solidity-a85c5bd0b0bc02d36a26ef5b3ba57cde4ddb0221.tar.bz2
dexon-solidity-a85c5bd0b0bc02d36a26ef5b3ba57cde4ddb0221.tar.lz
dexon-solidity-a85c5bd0b0bc02d36a26ef5b3ba57cde4ddb0221.tar.xz
dexon-solidity-a85c5bd0b0bc02d36a26ef5b3ba57cde4ddb0221.tar.zst
dexon-solidity-a85c5bd0b0bc02d36a26ef5b3ba57cde4ddb0221.zip
Merge pull request #2470 from chriseth/sol_fix_bytesComparison
Fix comparison between bytes types.
-rw-r--r--ExpressionCompiler.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index d949265d..6a2e185c 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -935,24 +935,27 @@ void ExpressionCompiler::appendCompareOperatorCode(Token::Value _operator, Type
}
else
{
- IntegerType const& type = dynamic_cast<IntegerType const&>(_type);
- bool const c_isSigned = type.isSigned();
+ bool isSigned = false;
+ if (auto type = dynamic_cast<IntegerType const*>(&_type))
+ isSigned = type->isSigned();
switch (_operator)
{
case Token::GreaterThanOrEqual:
- m_context << (c_isSigned ? eth::Instruction::SLT : eth::Instruction::LT)
- << eth::Instruction::ISZERO;
+ m_context <<
+ (isSigned ? eth::Instruction::SLT : eth::Instruction::LT) <<
+ eth::Instruction::ISZERO;
break;
case Token::LessThanOrEqual:
- m_context << (c_isSigned ? eth::Instruction::SGT : eth::Instruction::GT)
- << eth::Instruction::ISZERO;
+ m_context <<
+ (isSigned ? eth::Instruction::SGT : eth::Instruction::GT) <<
+ eth::Instruction::ISZERO;
break;
case Token::GreaterThan:
- m_context << (c_isSigned ? eth::Instruction::SGT : eth::Instruction::GT);
+ m_context << (isSigned ? eth::Instruction::SGT : eth::Instruction::GT);
break;
case Token::LessThan:
- m_context << (c_isSigned ? eth::Instruction::SLT : eth::Instruction::LT);
+ m_context << (isSigned ? eth::Instruction::SLT : eth::Instruction::LT);
break;
default:
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unknown comparison operator."));