aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-02-16 23:55:21 +0800
committerchriseth <chris@ethereum.org>2018-02-22 22:17:30 +0800
commit388718b59f604c944be6816ba50068014e563fb0 (patch)
tree0a3c4bf2b04a6aaba2c4beb40252617384159662 /libsolidity/analysis
parent8fc9535d43df26001f7b34488d073c06fc4fd358 (diff)
downloaddexon-solidity-388718b59f604c944be6816ba50068014e563fb0.tar.gz
dexon-solidity-388718b59f604c944be6816ba50068014e563fb0.tar.zst
dexon-solidity-388718b59f604c944be6816ba50068014e563fb0.zip
Introduce emit statement.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp9
-rw-r--r--libsolidity/analysis/TypeChecker.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 0ee16c89..d93ebbd1 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -955,6 +955,15 @@ void TypeChecker::endVisit(Return const& _return)
}
}
+void TypeChecker::endVisit(EmitStatement const& _emit)
+{
+ if (
+ _emit.eventCall().annotation().kind != FunctionCallKind::FunctionCall ||
+ dynamic_cast<FunctionType const&>(*type(_emit.eventCall().expression())).kind() != FunctionType::Kind::Event
+ )
+ m_errorReporter.typeError(_emit.eventCall().expression().location(), "Expression has to be an event.");
+}
+
bool TypeChecker::visit(VariableDeclarationStatement const& _statement)
{
if (!_statement.initialValue())
diff --git a/libsolidity/analysis/TypeChecker.h b/libsolidity/analysis/TypeChecker.h
index 344b019d..fc4ec6f0 100644
--- a/libsolidity/analysis/TypeChecker.h
+++ b/libsolidity/analysis/TypeChecker.h
@@ -94,6 +94,7 @@ private:
virtual bool visit(WhileStatement const& _whileStatement) override;
virtual bool visit(ForStatement const& _forStatement) override;
virtual void endVisit(Return const& _return) override;
+ virtual void endVisit(EmitStatement const& _emit) override;
virtual bool visit(VariableDeclarationStatement const& _variable) override;
virtual void endVisit(ExpressionStatement const& _statement) override;
virtual bool visit(Conditional const& _conditional) override;