Support for Solidity 0.8.22
Closed this issue · 5 comments
Solidity 0.8.22 allowed event definitions at file level.
https://soliditylang.org/blog/2023/10/25/solidity-0.8.22-release-announcement/
Also now we can emit events from different contexts so EmitStatement
must support MemberAccess
as well.
interface I {
event ForeignEvent();
}
contract C {
event ForeignEvent();
}
event E();
contract D {
function f() public {
// Emitting a foreign event would trigger an internal error on 0.8.21
emit I.ForeignEvent();
emit C.ForeignEvent();
// Emitting a file-level event. New feature.
emit E();
}
}
UPDATE:
This doesn't change the type because the MemberAccess
is created within the FunctionCall
's expression
. I added a test to show this.
I use solidity official antlr4-grammer to implement a more comprehensive ast parser. You can consider giving it a try:
https://github.com/jeasonstudio/solidity-antlr4
The difference between this project and the official grammar is that this parser supports "all" solidity versions. That is, it supports a weird superset of the language, which is necessary for a lot of projects (e.g., prettier-solidity). But I'm glad to see a parser generated by the official one!
The difference between this project and the official grammar is that this parser supports "all" solidity versions. That is, it supports a weird superset of the language, which is necessary for a lot of projects (e.g., prettier-solidity). But I'm glad to see a parser generated by the official one!
Thanks for your awesome project, I understand what you means, it's not easy to support the syntax of all versions of Solidity. As Solidity becoming more stable, it might be a better choice to align the versions of the parser and Solidity grammar one by one. : )