Clarified binary operator checking for integer types.

This commit is contained in:
Christian 2014-12-28 13:35:58 +01:00
parent 7dc7827907
commit 8442974617

View File

@ -201,16 +201,16 @@ TypePointer IntegerType::binaryOperatorResultImpl(Token::Value _operator, TypePo
if (!commonType) if (!commonType)
return TypePointer(); 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 (commonType->isAddress())
{
if (!Token::isCompareOp(_operator))
return TypePointer(); return TypePointer();
} else if (commonType->isHash() && !Token::isBitOp(_operator))
else if (commonType->isHash())
{
if (!(Token::isCompareOp(_operator) || Token::isBitOp(_operator)))
return TypePointer(); return TypePointer();
} else
return commonType; return commonType;
} }