|
|
|
@ -1,3 +1,4 @@ |
|
|
|
|
from decimal import Decimal, InvalidOperation |
|
|
|
|
from slither.core.expressions import BinaryOperationType, Literal, UnaryOperationType |
|
|
|
|
from slither.utils.integer_conversion import convert_string_to_int |
|
|
|
|
from slither.visitors.expression.expression import ExpressionVisitor |
|
|
|
@ -77,9 +78,9 @@ class ConstantFolding(ExpressionVisitor): |
|
|
|
|
raise NotConstant |
|
|
|
|
|
|
|
|
|
def _post_literal(self, expression): |
|
|
|
|
if expression.value.isdigit(): |
|
|
|
|
set_val(expression, int(expression.value)) |
|
|
|
|
else: |
|
|
|
|
try: |
|
|
|
|
set_val(expression, Decimal(expression.value)) |
|
|
|
|
except InvalidOperation: |
|
|
|
|
raise NotConstant |
|
|
|
|
|
|
|
|
|
def _post_assignement_operation(self, expression): |
|
|
|
|