Conversation
chriseth
left a comment
There was a problem hiding this comment.
Please add an assert to parseEmitStatement which checks for the emit keyword.
|
should this target 050? |
|
@chriseth I added the assertion you've requested. |
Changelog.md
Outdated
| ### 0.5.0 (unreleased) | ||
|
|
||
| Compiler features: | ||
| * Parser: Introduce emit as a keyword instead of parsing it as identifier. |
There was a problem hiding this comment.
Need to escape emit with the double backticks.
libsolidity/parsing/Parser.cpp
Outdated
|
|
||
| ASTPointer<EmitStatement> Parser::parseEmitStatement(ASTPointer<ASTString> const& _docString) | ||
| { | ||
| solAssert(m_scanner->currentToken() == Token::Emit, "Expected emit token."); |
There was a problem hiding this comment.
Well it will not be triggered, but mostly we use expectToken and not solAssert in this file.
There was a problem hiding this comment.
I thought that it would be invalid use of the function to call it when there is no emit token, but yeah, expectToken is probably still better.
| contract C { | ||
| event A(); | ||
| function f() { | ||
| emit A(); |
There was a problem hiding this comment.
I'm sure there's a test like this already?
There was a problem hiding this comment.
@axic We have some syntax tests that cover the usage of emit with non-event types, but none that doesn't expect parser / type errors. So I think this should be added.
There was a problem hiding this comment.
Are you sure? event_emit_simple in SolidityNameAndTypeResolution seems to be a duplicate of this
There was a problem hiding this comment.
@axic Oh, you're right. I forgot to search in SolidityNameAndTypeResolution. Will remove this one then.
9b2c622 to
520e252
Compare
|
It is failing: |
|
Also please rebase after #4178 was merged, perhaps some tests would need to be changed. |
|
@axic I will have a look why they are failing. |
0f5f378 to
d54dbff
Compare
|
It is weird that no tests seem to need an update. Does this fully disable invoking events without |
|
The check in |
|
It may be better to keep this for using the keyword and having a separate PR cleaning up the rest. |
Changelog.md
Outdated
| Language Features: | ||
| * General: Support ``pop()`` for storage arrays. | ||
| Compiler features: | ||
| * Parser: Introduce ``emit`` as a keyword instead of parsing it as identifier. |
There was a problem hiding this comment.
I think this is actually a breaking change, because emit cannot be used as an identifier anymore. Moved.
Closes #4107.
This PR introduces
emitas a proper keyword instead of parsing it as identifier.