OpenZeppelin/sgp

Safe handle missed trailing semicolon

Closed this issue · 2 comments

Example:

function get_array_length(uint256[] memory _data) public returns (uint256 size) {
    size = _data.length
}

Instead of exception, thrown here:

return self.visit(ctx.getChild(0))

Need to raise an exception to be handled by:

class SGPErrorListener(ErrorListener):

It will prevent the Exception raising here:

except Exception as e:

And produces an instance of:

class SGPError:

Which can be handled further by a user

UPD: alternately, a grammar can be changed to allow such construction

@0xGeorgii can you handle the following case, it's when _data doesn't exist.

function get_array_length() public returns (uint256 size) {
    size = _data.length;
}

@josepchetrit12 yes, it doesn't matter since it is not a structural grammar miss