Apply early analysis of cst state variables

pull/56/head
Josselin 6 years ago
parent 16aa6c5ac5
commit a59d812635
  1. 6
      slither/solc_parsing/declarations/contract.py
  2. 5
      slither/solc_parsing/slitherSolc.py

@ -189,6 +189,12 @@ class ContractSolc04(Contract):
self._variables[var.name] = var 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): def analyze_state_variables(self):
for var in self.variables: for var in self.variables:
var.analyze(self) var.analyze(self)

@ -215,6 +215,9 @@ class SlitherSolc(Slither):
contract.set_is_analyzed(True) contract.set_is_analyzed(True)
def _analyze_struct_events(self, contract): def _analyze_struct_events(self, contract):
contract.analyze_constant_state_variables()
# Struct can refer to enum, or state variables # Struct can refer to enum, or state variables
contract.analyze_structs() contract.analyze_structs()
# Event can refer to struct # Event can refer to struct
@ -236,7 +239,7 @@ class SlitherSolc(Slither):
contract.analyze_content_functions() contract.analyze_content_functions()
contract.set_is_analyzed(True) contract.set_is_analyzed(True)
def _convert_to_slithir(self): def _convert_to_slithir(self):
for contract in self.contracts: for contract in self.contracts:
for func in contract.functions + contract.modifiers: for func in contract.functions + contract.modifiers:

Loading…
Cancel
Save