diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-11 06:53:32 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-02-11 06:53:32 +0800 |
commit | c8ec79548b8f8825735ee96f1768e7fc5313d19e (patch) | |
tree | e16fabaed2fe52e4be735f19e3e981d95dfce662 /libsolidity | |
parent | 30cfad35484e9b903bf90bb723382aebc832d560 (diff) | |
download | dexon-solidity-c8ec79548b8f8825735ee96f1768e7fc5313d19e.tar.gz dexon-solidity-c8ec79548b8f8825735ee96f1768e7fc5313d19e.tar.zst dexon-solidity-c8ec79548b8f8825735ee96f1768e7fc5313d19e.zip |
Use the revert opcode in assert()
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 316ae888..2ed19a83 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -872,8 +872,14 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) { arguments.front()->accept(*this); utils().convertType(*arguments.front()->annotation().type, *function.parameterTypes().front(), false); - m_context << Instruction::ISZERO; - m_context.appendConditionalJumpTo(m_context.errorTag()); + // jump if condition was met + 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; } default: |