mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Code generator for revert with reason string.
This commit is contained in:
parent
8ab7dc036a
commit
012ab37fe3
@ -680,8 +680,25 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
|||||||
m_context << Instruction::SELFDESTRUCT;
|
m_context << Instruction::SELFDESTRUCT;
|
||||||
break;
|
break;
|
||||||
case FunctionType::Kind::Revert:
|
case FunctionType::Kind::Revert:
|
||||||
m_context.appendRevert();
|
{
|
||||||
|
if (!arguments.empty())
|
||||||
|
{
|
||||||
|
solAssert(arguments.size() == 1, "");
|
||||||
|
solAssert(function.parameterTypes().size() == 1, "");
|
||||||
|
m_context << u256(0);
|
||||||
|
arguments.front()->accept(*this);
|
||||||
|
utils().fetchFreeMemoryPointer();
|
||||||
|
utils().abiEncode(
|
||||||
|
{make_shared<IntegerType>(256), arguments.front()->annotation().type},
|
||||||
|
{make_shared<IntegerType>(256), make_shared<ArrayType>(DataLocation::Memory, true)}
|
||||||
|
);
|
||||||
|
utils().toSizeAfterFreeMemoryPointer();
|
||||||
|
m_context << Instruction::REVERT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_context.appendRevert();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case FunctionType::Kind::SHA3:
|
case FunctionType::Kind::SHA3:
|
||||||
{
|
{
|
||||||
TypePointers argumentTypes;
|
TypePointers argumentTypes;
|
||||||
|
Loading…
Reference in New Issue
Block a user