From a59d8126350c928e89b04833190edf709086dd20 Mon Sep 17 00:00:00 2001 From: Josselin Date: Thu, 25 Oct 2018 08:49:53 +0100 Subject: [PATCH] Apply early analysis of cst state variables --- slither/solc_parsing/declarations/contract.py | 6 ++++++ slither/solc_parsing/slitherSolc.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/slither/solc_parsing/declarations/contract.py b/slither/solc_parsing/declarations/contract.py index 1bfb8d4b0..8efece531 100644 --- a/slither/solc_parsing/declarations/contract.py +++ b/slither/solc_parsing/declarations/contract.py @@ -189,6 +189,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 d0a69cc13..302b4d5c7 100644 --- a/slither/solc_parsing/slitherSolc.py +++ b/slither/solc_parsing/slitherSolc.py @@ -215,6 +215,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 @@ -236,7 +239,7 @@ class SlitherSolc(Slither): contract.analyze_content_functions() contract.set_is_analyzed(True) - + def _convert_to_slithir(self): for contract in self.contracts: for func in contract.functions + contract.modifiers: