diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2017-03-14 22:22:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-14 22:22:01 +0800 |
commit | 409eb9e3e494ad5a45c14eb7f550ad8fad2b5573 (patch) | |
tree | ea29137b7c499b0ddbef1e62bb8a4d401c694224 /libsolidity/codegen/ExpressionCompiler.cpp | |
parent | 9aab3b8639afa6e30e866e052a412b6f39c6ef6c (diff) | |
parent | 47cd8964b8617e5c7e93232719224c8334a4c764 (diff) | |
download | dexon-solidity-409eb9e3e494ad5a45c14eb7f550ad8fad2b5573.tar dexon-solidity-409eb9e3e494ad5a45c14eb7f550ad8fad2b5573.tar.gz dexon-solidity-409eb9e3e494ad5a45c14eb7f550ad8fad2b5573.tar.bz2 dexon-solidity-409eb9e3e494ad5a45c14eb7f550ad8fad2b5573.tar.lz dexon-solidity-409eb9e3e494ad5a45c14eb7f550ad8fad2b5573.tar.xz dexon-solidity-409eb9e3e494ad5a45c14eb7f550ad8fad2b5573.tar.zst dexon-solidity-409eb9e3e494ad5a45c14eb7f550ad8fad2b5573.zip |
Merge pull request #1765 from ethereum/requireAssert
Require and Assert.
Diffstat (limited to 'libsolidity/codegen/ExpressionCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ExpressionCompiler.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp index 5192ffa6..744a80c4 100644 --- a/libsolidity/codegen/ExpressionCompiler.cpp +++ b/libsolidity/codegen/ExpressionCompiler.cpp @@ -879,14 +879,18 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) break; } case Location::Assert: + case Location::Require: { arguments.front()->accept(*this); utils().convertType(*arguments.front()->annotation().type, *function.parameterTypes().front(), false); // jump if condition was met m_context << Instruction::ISZERO << Instruction::ISZERO; auto success = m_context.appendConditionalJump(); - // condition was not met, flag an error - m_context << Instruction::INVALID; + if (function.location() == Location::Assert) + // condition was not met, flag an error + m_context << Instruction::INVALID; + else + m_context << u256(0) << u256(0) << Instruction::REVERT; // the success branch m_context << success; break; |