Convert ternary operator in modifier (close #140)

pull/132/head
Josselin 6 years ago
parent 983677205f
commit 98fdc339ab
  1. 5
      slither/solc_parsing/declarations/function.py
  2. 3
      slither/solc_parsing/declarations/modifier.py

@ -833,6 +833,10 @@ class FunctionSolc(Function):
for node in self.nodes: for node in self.nodes:
node.analyze_expressions(self) node.analyze_expressions(self)
self._filter_ternary()
self._remove_alone_endif()
def _filter_ternary(self):
ternary_found = True ternary_found = True
while ternary_found: while ternary_found:
ternary_found = False ternary_found = False
@ -847,7 +851,6 @@ class FunctionSolc(Function):
self.split_ternary_node(node, condition, true_expr, false_expr) self.split_ternary_node(node, condition, true_expr, false_expr)
ternary_found = True ternary_found = True
break break
self._remove_alone_endif()
def get_last_ssa_state_variables_instances(self): def get_last_ssa_state_variables_instances(self):
if not self.is_implemented: if not self.is_implemented:

@ -59,6 +59,9 @@ class ModifierSolc(Modifier, FunctionSolc):
for node in self.nodes: for node in self.nodes:
node.analyze_expressions(self) node.analyze_expressions(self)
self._filter_ternary()
self._remove_alone_endif()
self._analyze_read_write() self._analyze_read_write()
self._analyze_calls() self._analyze_calls()

Loading…
Cancel
Save