aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Kundt <bitshift@posteo.org>2018-05-23 17:57:52 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-06-12 04:21:22 +0800
commit2e9f5d1c98af76dbab4960f095a5fef1ddfc7db5 (patch)
treeab415cf848fd48d0cdca81b92250d9f6aa88d388
parentd85120c0739b5c23be4107b6f1ba6e26868b96cd (diff)
downloaddexon-solidity-2e9f5d1c98af76dbab4960f095a5fef1ddfc7db5.tar.gz
dexon-solidity-2e9f5d1c98af76dbab4960f095a5fef1ddfc7db5.tar.zst
dexon-solidity-2e9f5d1c98af76dbab4960f095a5fef1ddfc7db5.zip
Introduces emit token and removes identifier workaround.
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/parsing/Parser.cpp9
-rw-r--r--libsolidity/parsing/Token.h1
3 files changed, 8 insertions, 3 deletions
diff --git a/Changelog.md b/Changelog.md
index f28278b3..0050f9a6 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -8,6 +8,7 @@ Breaking Changes:
* Commandline interface: Require ``-`` if standard input is used as source.
* General: New keywords: ``calldata``
* General: ``continue`` in a ``do...while`` loop jumps to the condition (it used to jump to the loop body). Warning: this may silently change the semantics of existing code.
+ * Introduce ``emit`` as a keyword instead of parsing it as identifier.
* Type Checker: Disallow arithmetic operations for Boolean variables.
* Disallow trailing dots that are not followed by a number.
* Remove assembly instructions ``sha3`` and ``suicide``
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index aec9ebbb..e9810fe3 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -939,10 +939,11 @@ ASTPointer<Statement> Parser::parseStatement()
}
case Token::Assembly:
return parseInlineAssembly(docString);
+ case Token::Emit:
+ statement = parseEmitStatement(docString);
+ break;
case Token::Identifier:
- if (m_scanner->currentLiteral() == "emit")
- statement = parseEmitStatement(docString);
- else if (m_insideModifier && m_scanner->currentLiteral() == "_")
+ if (m_insideModifier && m_scanner->currentLiteral() == "_")
{
statement = ASTNodeFactory(*this).createNode<PlaceholderStatement>(docString);
m_scanner->next();
@@ -1062,6 +1063,8 @@ ASTPointer<ForStatement> Parser::parseForStatement(ASTPointer<ASTString> const&
ASTPointer<EmitStatement> Parser::parseEmitStatement(ASTPointer<ASTString> const& _docString)
{
+ expectToken(Token::Emit, false);
+
ASTNodeFactory nodeFactory(*this);
m_scanner->next();
ASTNodeFactory eventCallNodeFactory(*this);
diff --git a/libsolidity/parsing/Token.h b/libsolidity/parsing/Token.h
index 4d456550..845a97bc 100644
--- a/libsolidity/parsing/Token.h
+++ b/libsolidity/parsing/Token.h
@@ -149,6 +149,7 @@ namespace solidity
K(Do, "do", 0) \
K(Else, "else", 0) \
K(Enum, "enum", 0) \
+ K(Emit, "emit", 0) \
K(Event, "event", 0) \
K(External, "external", 0) \
K(For, "for", 0) \