Minor detector improvements

pull/81/head
Josselin 6 years ago
parent 6a1c98434b
commit cc64b0a594
  1. 2
      slither/detectors/statements/assembly.py
  2. 6
      slither/detectors/variables/unused_state_variables.py

@ -30,6 +30,8 @@ class Assembly(AbstractDetector):
def detect_assembly(self, contract): def detect_assembly(self, contract):
ret = [] ret = []
for f in contract.functions: for f in contract.functions:
if f.contract != contract:
continue
nodes = f.nodes nodes = f.nodes
assembly_nodes = [n for n in nodes if assembly_nodes = [n for n in nodes if
self._contains_inline_assembly_use(n)] self._contains_inline_assembly_use(n)]

@ -39,10 +39,12 @@ class UnusedStateVars(AbstractDetector):
unusedVarsName = [v.name for v in unusedVars] unusedVarsName = [v.name for v in unusedVars]
info = '' info = ''
for var in unusedVars: for var in unusedVars:
info += "{}.{} ({}) is never used\n".format(var.contract.name, var.name, var.source_mapping_str) info += "{}.{} ({}) is never used in {}\n".format(var.contract.name,
var.name,
var.source_mapping_str,
c.name)
all_info += info all_info += info
sourceMapping = [v.source_mapping for v in unusedVars] sourceMapping = [v.source_mapping for v in unusedVars]
results.append({'vuln': 'unusedStateVars', results.append({'vuln': 'unusedStateVars',

Loading…
Cancel
Save