Merge pull request #997 from crytic/dev-minor-fixes

Multiple minor fixes
pull/999/head
Feist Josselin 3 years ago committed by GitHub
commit 59c07e1f4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      slither/core/cfg/node.py
  2. 4
      slither/detectors/statements/write_after_write.py

@ -200,6 +200,7 @@ class Node(SourceMapping, ChildFunction): # pylint: disable=too-many-public-met
self._external_calls_as_expressions: List[Expression] = [] self._external_calls_as_expressions: List[Expression] = []
self._internal_calls_as_expressions: List[Expression] = [] self._internal_calls_as_expressions: List[Expression] = []
self._irs: List[Operation] = [] self._irs: List[Operation] = []
self._all_slithir_operations: Optional[List[Operation]] = None
self._irs_ssa: List[Operation] = [] self._irs_ssa: List[Operation] = []
self._state_vars_written: List[StateVariable] = [] self._state_vars_written: List[StateVariable] = []
@ -721,11 +722,13 @@ class Node(SourceMapping, ChildFunction): # pylint: disable=too-many-public-met
self._find_read_write_call() self._find_read_write_call()
def all_slithir_operations(self) -> List[Operation]: def all_slithir_operations(self) -> List[Operation]:
irs = self.irs if self._all_slithir_operations is None:
for ir in irs: irs = list(self.irs)
if isinstance(ir, InternalCall): for ir in self.irs:
irs += ir.function.all_slithir_operations() if isinstance(ir, InternalCall):
return irs irs += ir.function.all_slithir_operations()
self._all_slithir_operations = irs
return self._all_slithir_operations
@staticmethod @staticmethod
def _is_non_slithir_var(var: Variable): def _is_non_slithir_var(var: Variable):

@ -13,7 +13,7 @@ from slither.slithir.operations import (
LowLevelCall, LowLevelCall,
Operation, Operation,
) )
from slither.slithir.variables import ReferenceVariable, TemporaryVariable from slither.slithir.variables import ReferenceVariable, TemporaryVariable, TupleVariable
from slither.slithir.variables.variable import SlithIRVariable from slither.slithir.variables.variable import SlithIRVariable
@ -59,7 +59,7 @@ def _handle_ir(
if ( if (
ir.lvalue ir.lvalue
and isinstance(ir.lvalue.type, ElementaryType) and isinstance(ir.lvalue.type, ElementaryType)
and not isinstance(ir.lvalue, (ReferenceVariable, TemporaryVariable)) and not isinstance(ir.lvalue, (ReferenceVariable, TemporaryVariable, TupleVariable))
): ):
if ir.lvalue.name == "_": if ir.lvalue.name == "_":
return return

Loading…
Cancel
Save