|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
from typing import Optional, Union, TYPE_CHECKING |
|
|
|
|
|
|
|
|
|
from slither.core.expressions.expression import Expression |
|
|
|
|
from slither.core.solidity_types.elementary_type import Byte, Fixed, Int, Ufixed, Uint |
|
|
|
|
from slither.utils.arithmetic import convert_subdenomination |
|
|
|
|
from slither.utils.integer_conversion import convert_string_to_int |
|
|
|
|
|
|
|
|
@ -30,8 +31,12 @@ class Literal(Expression): |
|
|
|
|
def __str__(self): |
|
|
|
|
if self.subdenomination: |
|
|
|
|
return str(convert_subdenomination(self._value, self.subdenomination)) |
|
|
|
|
elif self.type in Int + Uint + Fixed + Ufixed + ["address"]: |
|
|
|
|
return str(convert_string_to_int(self._value)) |
|
|
|
|
|
|
|
|
|
# be sure to handle any character |
|
|
|
|
return str(self._value) |
|
|
|
|
|
|
|
|
|
def __eq__(self, other): |
|
|
|
|
if not isinstance(other, Literal): |
|
|
|
|
return False |
|
|
|
|