diff --git a/slither/solc_parsing/declarations/function.py b/slither/solc_parsing/declarations/function.py index 59e4379b5..7ad6c4ba7 100644 --- a/slither/solc_parsing/declarations/function.py +++ b/slither/solc_parsing/declarations/function.py @@ -257,15 +257,27 @@ class FunctionSolc(Function): # if the loop has a init value /condition or expression # There is no way to determine that for(a;;) and for(;a;) are different with old solc if 'attributes' in statement: + attributes = statement['attributes'] if 'initializationExpression' in statement: if not statement['initializationExpression']: hasInitExession = False + elif 'initializationExpression' in attributes: + if not attributes['initializationExpression']: + hasInitExession = False + if 'condition' in statement: if not statement['condition']: hasCondition = False + elif 'condition' in attributes: + if not attributes['condition']: + hasCondition = False + if 'loopExpression' in statement: if not statement['loopExpression']: hasLoopExpression = False + elif 'loopExpression' in attributes: + if not attributes['loopExpression']: + hasLoopExpression = False node_startLoop = self._new_node(NodeType.STARTLOOP, statement['src'])