Updated shadowing-local to output events as events, instead of functions.

pull/226/head
David Pokora 6 years ago
parent c449d99f22
commit d34570afc1
No known key found for this signature in database
GPG Key ID: 3CED48D1BB21BDD7
  1. 7
      slither/detectors/shadowing/local.py

@ -42,7 +42,6 @@ contract Bug {
WIKI_RECOMMENDATION = 'Rename the local variable so as not to mistakenly overshadow any state variable/function/modifier/event definitions.' WIKI_RECOMMENDATION = 'Rename the local variable so as not to mistakenly overshadow any state variable/function/modifier/event definitions.'
OVERSHADOWED_FUNCTION = "function" OVERSHADOWED_FUNCTION = "function"
OVERSHADOWED_MODIFIER = "modifier" OVERSHADOWED_MODIFIER = "modifier"
OVERSHADOWED_STATE_VARIABLE = "state variable" OVERSHADOWED_STATE_VARIABLE = "state variable"
@ -116,14 +115,14 @@ contract Bug {
overshadowed_entry[0], overshadowed_entry[0],
overshadowed_entry[2].source_mapping_str) overshadowed_entry[2].source_mapping_str)
# Generate relevant JSON data for this shadowing definition. # Generate relevant JSON data for this shadowing definition.
json = self.generate_json_result(info) json = self.generate_json_result(info)
self.add_variable_to_json(local_variable, json) self.add_variable_to_json(local_variable, json)
for overshadowed_entry in overshadowed: for overshadowed_entry in overshadowed:
if overshadowed_entry[0] in [self.OVERSHADOWED_FUNCTION, self.OVERSHADOWED_MODIFIER, if overshadowed_entry[0] in [self.OVERSHADOWED_FUNCTION, self.OVERSHADOWED_MODIFIER]:
self.OVERSHADOWED_EVENT]:
self.add_function_to_json(overshadowed_entry[2], json) self.add_function_to_json(overshadowed_entry[2], json)
elif overshadowed_entry[0] == self.OVERSHADOWED_EVENT:
self.add_event_to_json(overshadowed_entry[2], json)
elif overshadowed_entry[0] == self.OVERSHADOWED_STATE_VARIABLE: elif overshadowed_entry[0] == self.OVERSHADOWED_STATE_VARIABLE:
self.add_variable_to_json(overshadowed_entry[2], json) self.add_variable_to_json(overshadowed_entry[2], json)
results.append(json) results.append(json)

Loading…
Cancel
Save