Solidity allows to specify arguments in the inheriance specifiers with parens. However, empty parens are also allowed (compiled tested on Remix IDE). Unfortunately, solidity-parser-antlr is failing to parse it.
contract Base {
uint x;
constructor () public {
x = x + 1;
}
}
contract Child is Base() {
function main() public {
assert(x == 1);
}
}
Output
TypeError: Cannot read property 'length' of null
at ASTBuilder.Expression (project/node_modules/solidity-parser-antlr/dist/ASTBuilder.js:483:26)
at ASTBuilder.visit (project/node_modules/solidity-parser-antlr/dist/ASTBuilder.js:1167:38)
at ASTBuilder.<anonymous> (project/node_modules/solidity-parser-antlr/dist/ASTBuilder.js:1155:19)
at Array.map (<anonymous>)
at ASTBuilder.visit (project/node_modules/solidity-parser-antlr/dist/ASTBuilder.js:1154:16)
at ASTBuilder.InheritanceSpecifier (project/node_modules/solidity-parser-antlr/dist/ASTBuilder.js:118:23)
at ASTBuilder.visit (project/node_modules/solidity-parser-antlr/dist/ASTBuilder.js:1167:38)
at ASTBuilder.<anonymous> (project/node_modules/solidity-parser-antlr/dist/ASTBuilder.js:1155:19)
at Array.map (<anonymous>)
at ASTBuilder.visit (project/node_modules/solidity-parser-antlr/dist/ASTBuilder.js:1154:16)
Brief
Solidity allows to specify arguments in the inheriance specifiers with parens. However, empty parens are also allowed (compiled tested on Remix IDE). Unfortunately, solidity-parser-antlr is failing to parse it.
It seems to be caused by the
inheritanceSpecifier
grammar rule which is requiring at least one argument.Sample:
Output
Consider to fix. Regards.