Fix incorrect variable assignment in _parse_modifier, add Nop in copy_ir

pull/406/head
Josselin 5 years ago
parent faeb9ed8cc
commit 36a1af528b
  1. 4
      slither/slithir/utils/ssa.py
  2. 1
      slither/solc_parsing/declarations/function.py

@ -17,7 +17,7 @@ from slither.slithir.operations import (Assignment, Balance, Binary, Condition,
OperationWithLValue, Phi, PhiCallback, OperationWithLValue, Phi, PhiCallback,
Push, Return, Send, SolidityCall, Push, Return, Send, SolidityCall,
Transfer, TypeConversion, Unary, Transfer, TypeConversion, Unary,
Unpack) Unpack, Nop)
from slither.slithir.variables import (Constant, LocalIRVariable, from slither.slithir.variables import (Constant, LocalIRVariable,
ReferenceVariable, ReferenceVariableSSA, ReferenceVariable, ReferenceVariableSSA,
StateIRVariable, TemporaryVariable, StateIRVariable, TemporaryVariable,
@ -620,6 +620,8 @@ def copy_ir(ir, *instances):
new_ir = NewStructure(structure, lvalue) new_ir = NewStructure(structure, lvalue)
new_ir.arguments = get_arguments(ir, *instances) new_ir.arguments = get_arguments(ir, *instances)
return new_ir return new_ir
elif isinstance(ir, Nop):
return Nop()
elif isinstance(ir, Push): elif isinstance(ir, Push):
array = get_variable(ir, lambda x: x.array, *instances) array = get_variable(ir, lambda x: x.array, *instances)
lvalue = get_variable(ir, lambda x: x.lvalue, *instances) lvalue = get_variable(ir, lambda x: x.lvalue, *instances)

@ -928,7 +928,6 @@ class FunctionSolc(Function):
else: else:
latest_entry_point = self.entry_point latest_entry_point = self.entry_point
insert_node(latest_entry_point, node) insert_node(latest_entry_point, node)
node = latest_entry_point
self._explicit_base_constructor_calls.append(ModifierStatements(modifier=m, self._explicit_base_constructor_calls.append(ModifierStatements(modifier=m,
entry_point=latest_entry_point, entry_point=latest_entry_point,
nodes=[latest_entry_point, node])) nodes=[latest_entry_point, node]))

Loading…
Cancel
Save