Merge pull request #439 from crytic/dev-ternary

Add support for ternary on unary operator
pull/445/head
Feist Josselin 5 years ago committed by GitHub
commit 92916c4712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      slither/utils/expression_manipulations.py

@ -3,6 +3,8 @@
as they should be immutable
"""
import copy
from slither.core.expressions import UnaryOperation
from slither.core.expressions.assignment_operation import AssignmentOperation
from slither.core.expressions.binary_operation import BinaryOperation
from slither.core.expressions.call_expression import CallExpression
@ -112,6 +114,13 @@ class SplitTernaryExpression(object):
true_expression.expression,
false_expression.expression)
elif isinstance(expression, UnaryOperation):
next_expr = expression.expression
if self.apply_copy(next_expr, true_expression, false_expression, f_expression):
self.copy_expression(expression.expression,
true_expression.expression,
false_expression.expression)
else:
raise SlitherException('Ternary operation not handled {}({})'.format(expression, type(expression)))

Loading…
Cancel
Save