diff --git a/slither/solc_parsing/declarations/contract.py b/slither/solc_parsing/declarations/contract.py index 314f6573e..087750577 100644 --- a/slither/solc_parsing/declarations/contract.py +++ b/slither/solc_parsing/declarations/contract.py @@ -233,6 +233,12 @@ class ContractSolc04(Contract): self._variables[var.name] = var + def analyze_constant_state_variables(self): + for var in self.variables: + if var.is_constant: + var.analyze(self) + return + def analyze_state_variables(self): for var in self.variables: var.analyze(self) diff --git a/slither/solc_parsing/slitherSolc.py b/slither/solc_parsing/slitherSolc.py index f172ab6b2..28108f3fd 100644 --- a/slither/solc_parsing/slitherSolc.py +++ b/slither/solc_parsing/slitherSolc.py @@ -251,6 +251,9 @@ class SlitherSolc(Slither): contract.set_is_analyzed(True) def _analyze_struct_events(self, contract): + + contract.analyze_constant_state_variables() + # Struct can refer to enum, or state variables contract.analyze_structs() # Event can refer to struct