python-solidity-parser icon indicating copy to clipboard operation
python-solidity-parser copied to clipboard

Fix missing ident with omitted fields in tuple assignment

Open cassc opened this issue 2 years ago • 1 comments

The parser will fail if we omit fields in tuple assignment, for example with the following contract Simple.sol,

pragma solidity ^0.8.0;
contract Simple {
    function withdraw(uint _amount) public {
        if (_amount > 1000){
            (bool result,) = msg.sender.call{value:_amount}("");
            require(result);
        }
    }
}

python -m solidity_parser outline Simple.sol fails with Exception: unrecognized expression

This PR fixes the error by checking the existance of identifier before getting the text name from it.

cassc avatar May 11 '22 06:05 cassc

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 11 '22 06:05 CLAassistant