Open
Description
Describe the desired feature
Right now, each detector implements its own ad-hoc approach to iterating over a compilation unit. This leaves the analysis author to understand and decide between contracts
vs contracts_derived
and functions
vs functions_top_level
vs functions_and_modifiers
(even more if we consider inherited vs declared). While for some detectors there is a need for specialization, the vast majority of analyses could reuse a visitor from the AbstractDetector
like visit_all_contracts_derived_functions
. There are several benefits to this approach:
- These visitors require less understanding of the core API and can be clearly documented with guidance on when they should be used.
- It will make it easier to survey which detectors and analyze what and update changes to detectors en masse e.g. some detectors likely need to be update to support top level functions.
- I believe this would greatly impact performance positively. Rather than N detectors iterating over every comp. unit, contract, function,
AbstractDetector
would iterator over these and invoke each detector's visitor, reducing complexity.