From 8442974617e7d3b357144bd88c64904a12cd976f Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 28 Dec 2014 13:35:58 +0100 Subject: [PATCH] Clarified binary operator checking for integer types. --- Types.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Types.cpp b/Types.cpp index 664b56ff6..c87ce2e60 100644 --- a/Types.cpp +++ b/Types.cpp @@ -201,17 +201,17 @@ TypePointer IntegerType::binaryOperatorResultImpl(Token::Value _operator, TypePo if (!commonType) return TypePointer(); + // All integer types can be compared + if (Token::isCompareOp(_operator)) + return commonType; + + // Nothing else can be done with addresses, but hashes can receive bit operators if (commonType->isAddress()) - { - if (!Token::isCompareOp(_operator)) - return TypePointer(); - } - else if (commonType->isHash()) - { - if (!(Token::isCompareOp(_operator) || Token::isBitOp(_operator))) - return TypePointer(); - } - return commonType; + return TypePointer(); + else if (commonType->isHash() && !Token::isBitOp(_operator)) + return TypePointer(); + else + return commonType; } const MemberList IntegerType::AddressMemberList =