Fix non-numeric literals

pull/1377/head
Emilio López 2 years ago
parent 2879514f23
commit 237bb53591
  1. 7
      slither/core/expressions/literal.py

@ -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,7 +31,11 @@ class Literal(Expression):
def __str__(self):
if self.subdenomination:
return str(convert_subdenomination(self._value, self.subdenomination))
return str(convert_string_to_int(self._value))
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):

Loading…
Cancel
Save