mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use the revert opcode in assert()
This commit is contained in:
parent
30cfad3548
commit
c8ec79548b
@ -872,8 +872,14 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
|||||||
{
|
{
|
||||||
arguments.front()->accept(*this);
|
arguments.front()->accept(*this);
|
||||||
utils().convertType(*arguments.front()->annotation().type, *function.parameterTypes().front(), false);
|
utils().convertType(*arguments.front()->annotation().type, *function.parameterTypes().front(), false);
|
||||||
m_context << Instruction::ISZERO;
|
// jump if condition was met
|
||||||
m_context.appendConditionalJumpTo(m_context.errorTag());
|
m_context << Instruction::ISZERO << Instruction::ISZERO;
|
||||||
|
auto success = m_context.appendConditionalJump();
|
||||||
|
// condition was not met, abort
|
||||||
|
m_context << u256(0) << u256(0);
|
||||||
|
m_context << Instruction::REVERT;
|
||||||
|
// the success branch
|
||||||
|
m_context << success;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user