mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
add call for EventDefinition::checkTypeRequirements()
This commit is contained in:
parent
f5fc119dc8
commit
1d1386a58c
@ -85,6 +85,9 @@ void ContractDefinition::checkTypeRequirements()
|
||||
for (ASTPointer<VariableDeclaration> const& variable: m_stateVariables)
|
||||
variable->checkTypeRequirements();
|
||||
|
||||
for (ASTPointer<EventDefinition> const& event: events())
|
||||
event->checkTypeRequirements();
|
||||
|
||||
for (ASTPointer<ModifierDefinition> const& modifier: functionModifiers())
|
||||
modifier->checkTypeRequirements();
|
||||
|
||||
@ -699,13 +702,13 @@ void EventDefinition::checkTypeRequirements()
|
||||
{
|
||||
if (var->isIndexed())
|
||||
numIndexed++;
|
||||
if (numIndexed > 3)
|
||||
BOOST_THROW_EXCEPTION(createTypeError("More than 3 indexed arguments for event."));
|
||||
if (!var->type()->canLiveOutsideStorage())
|
||||
BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage."));
|
||||
if (!var->type()->externalType())
|
||||
BOOST_THROW_EXCEPTION(var->createTypeError("Internal type is not allowed as event parameter type."));
|
||||
}
|
||||
if (numIndexed > 3)
|
||||
BOOST_THROW_EXCEPTION(createTypeError("More than 3 indexed arguments for event."));
|
||||
}
|
||||
|
||||
void Block::checkTypeRequirements()
|
||||
|
@ -5230,20 +5230,6 @@ BOOST_AUTO_TEST_CASE(storage_string_as_mapping_key_without_variable)
|
||||
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(2)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(event_more_than_four_indexed_arguments)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract ClientReceipt {
|
||||
event Deposit(uint indexed _var0, uint indexed _var1, uint indexed _var2, uint indexed _var3, uint indexed _var4, uint indexed _var5);
|
||||
function deposit() {
|
||||
Deposit(0, 1, 2, 3, 4, 5);
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
compileRequireThrow<TypeError>(sourceCode);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -1050,7 +1050,6 @@ BOOST_AUTO_TEST_CASE(event_too_many_indexed)
|
||||
char const* text = R"(
|
||||
contract c {
|
||||
event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d);
|
||||
function f() { e(2, "abc", true); }
|
||||
})";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user