mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Implemented events with indexed function as parameter in Yul
This commit is contained in:
parent
3970412422
commit
fd02ccc68c
@ -929,6 +929,20 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
"(" <<
|
"(" <<
|
||||||
IRVariable(arg).commaSeparatedList() <<
|
IRVariable(arg).commaSeparatedList() <<
|
||||||
")";
|
")";
|
||||||
|
else if (auto functionType = dynamic_cast<FunctionType const*>(paramTypes[i]))
|
||||||
|
{
|
||||||
|
solAssert(
|
||||||
|
IRVariable(arg).type() == *functionType &&
|
||||||
|
functionType->kind() == FunctionType::Kind::External &&
|
||||||
|
!functionType->bound(),
|
||||||
|
""
|
||||||
|
);
|
||||||
|
define(indexedArgs.emplace_back(m_context.newYulVariable(), *TypeProvider::fixedBytes(32))) <<
|
||||||
|
m_utils.combineExternalFunctionIdFunction() <<
|
||||||
|
"(" <<
|
||||||
|
IRVariable(arg).commaSeparatedList() <<
|
||||||
|
")\n";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
indexedArgs.emplace_back(convert(arg, *paramTypes[i]));
|
indexedArgs.emplace_back(convert(arg, *paramTypes[i]));
|
||||||
}
|
}
|
||||||
|
@ -2463,6 +2463,10 @@ BOOST_AUTO_TEST_CASE(event_indexed_function)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|
||||||
|
ALSO_VIA_YUL(
|
||||||
|
DISABLE_EWASM_TESTRUN()
|
||||||
|
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
callContractFunction("f()");
|
callContractFunction("f()");
|
||||||
BOOST_REQUIRE_EQUAL(numLogs(), 1);
|
BOOST_REQUIRE_EQUAL(numLogs(), 1);
|
||||||
@ -2478,6 +2482,7 @@ BOOST_AUTO_TEST_CASE(event_indexed_function)
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL(logTopic(0, 1).hex(), util::toHex(functionABI));
|
BOOST_CHECK_EQUAL(logTopic(0, 1).hex(), util::toHex(functionABI));
|
||||||
BOOST_CHECK_EQUAL(logTopic(0, 0), util::keccak256(string("Test(function)")));
|
BOOST_CHECK_EQUAL(logTopic(0, 0), util::keccak256(string("Test(function)")));
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one)
|
BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one)
|
||||||
|
Loading…
Reference in New Issue
Block a user