From 4a6ed84386ed7bc3abd2b4cf2441b29a5af38816 Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 29 Jan 2015 14:35:28 +0100 Subject: Parsing of events. --- AST.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'AST.cpp') diff --git a/AST.cpp b/AST.cpp index bc6be600..82d58d2a 100644 --- a/AST.cpp +++ b/AST.cpp @@ -271,6 +271,20 @@ void ModifierInvocation::checkTypeRequirements() BOOST_THROW_EXCEPTION(createTypeError("Invalid type for argument in modifier invocation.")); } +void EventDefinition::checkTypeRequirements() +{ + int numIndexed = 0; + for (ASTPointer const& var: getParameters()) + { + if (var->isIndexed()) + numIndexed++; + if (!var->getType()->canLiveOutsideStorage()) + BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage.")); + } + if (numIndexed > 3) + BOOST_THROW_EXCEPTION(createTypeError("More than 3 indexed arguments for event.")); +} + void Block::checkTypeRequirements() { for (shared_ptr const& statement: m_statements) -- cgit