From a4032dc000101668ac16a666283a99229468b087 Mon Sep 17 00:00:00 2001 From: Josselin Date: Tue, 11 Dec 2018 17:14:15 -0500 Subject: [PATCH] Parse local variables prior parsing modifier (fix 99) --- slither/solc_parsing/declarations/function.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index 7e8b1c6fe..7669716de 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -804,11 +804,12 @@ class FunctionSolc(Function): if child[self.get_key()] == 'Block': self._is_implemented = True self._parse_cfg(child) - continue - - assert child[self.get_key()] == 'ModifierInvocation' - - self._parse_modifier(child) + + # Parse modifier after parsing all the block + # In the case a local variable is used in the modifier + for child in children[2:]: + if child[self.get_key()] == 'ModifierInvocation': + self._parse_modifier(child) for local_vars in self.variables: local_vars.analyze(self)