|
|
|
@ -89,7 +89,14 @@ class BinaryType(Enum): |
|
|
|
|
raise SlithIRError("get_type: Unknown operation type {})".format(operation_type)) |
|
|
|
|
|
|
|
|
|
def can_be_checked_for_overflow(self): |
|
|
|
|
return self in [BinaryType.POWER, BinaryType.MULTIPLICATION, BinaryType.MODULO, BinaryType.ADDITION, BinaryType.SUBTRACTION, BinaryType.DIVISION] |
|
|
|
|
return self in [ |
|
|
|
|
BinaryType.POWER, |
|
|
|
|
BinaryType.MULTIPLICATION, |
|
|
|
|
BinaryType.MODULO, |
|
|
|
|
BinaryType.ADDITION, |
|
|
|
|
BinaryType.SUBTRACTION, |
|
|
|
|
BinaryType.DIVISION, |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
def __str__(self): # pylint: disable=too-many-branches |
|
|
|
|
if self == BinaryType.POWER: |
|
|
|
@ -171,7 +178,7 @@ class Binary(OperationWithLValue): |
|
|
|
|
@property |
|
|
|
|
def type_str(self): |
|
|
|
|
if self.node.scope.is_checked and self._type.can_be_checked_for_overflow(): |
|
|
|
|
return '(c)' + str(self._type) |
|
|
|
|
return "(c)" + str(self._type) |
|
|
|
|
return str(self._type) |
|
|
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
|