Skip to content

Commit

Permalink
Merge pull request #1489 from crytic/remove-push
Browse files Browse the repository at this point in the history
remove unused PUSH operation from IR
  • Loading branch information
montyly authored Dec 20, 2022
2 parents 5314d76 + 89dee16 commit bcbd072
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 40 deletions.
4 changes: 0 additions & 4 deletions slither/slithir/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
NewElementaryType,
NewStructure,
OperationWithLValue,
Push,
Return,
Send,
SolidityCall,
Expand Down Expand Up @@ -745,9 +744,6 @@ def propagate_types(ir, node: "Node"): # pylint: disable=too-many-locals
ir.lvalue.set_type(ir.type)
elif isinstance(ir, NewStructure):
ir.lvalue.set_type(UserDefinedType(ir.structure))
elif isinstance(ir, Push):
# No change required
pass
elif isinstance(ir, Send):
ir.lvalue.set_type(ElementaryType("bool"))
elif isinstance(ir, SolidityCall):
Expand Down
1 change: 0 additions & 1 deletion slither/slithir/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from .new_contract import NewContract
from .new_structure import NewStructure
from .operation import Operation
from .push import Push
from .return_operation import Return
from .send import Send
from .solidity_call import SolidityCall
Expand Down
27 changes: 0 additions & 27 deletions slither/slithir/operations/push.py

This file was deleted.

5 changes: 0 additions & 5 deletions slither/slithir/utils/ssa.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
OperationWithLValue,
Phi,
PhiCallback,
Push,
Return,
Send,
SolidityCall,
Expand Down Expand Up @@ -780,10 +779,6 @@ def copy_ir(ir, *instances):
return new_ir
if isinstance(ir, Nop):
return Nop()
if isinstance(ir, Push):
array = get_variable(ir, lambda x: x.array, *instances)
lvalue = get_variable(ir, lambda x: x.lvalue, *instances)
return Push(array, lvalue)
if isinstance(ir, Return):
values = get_rec_values(ir, lambda x: x.values, *instances)
return Return(values)
Expand Down
3 changes: 0 additions & 3 deletions slither/tools/similarity/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
NewContract,
NewElementaryType,
SolidityCall,
Push,
Delete,
EventCall,
LibraryCall,
Expand Down Expand Up @@ -163,8 +162,6 @@ def encode_ir(ir): # pylint: disable=too-many-branches
return f"new_array({ntype(ir.array_type)})"
if isinstance(ir, NewElementaryType):
return f"new_elementary({ntype(ir.type)})"
if isinstance(ir, Push):
return f"push({encode_ir(ir.value)},{encode_ir(ir.lvalue)})"
if isinstance(ir, Delete):
return f"delete({encode_ir(ir.lvalue)},{encode_ir(ir.variable)})"
if isinstance(ir, SolidityCall):
Expand Down

0 comments on commit bcbd072

Please sign in to comment.