aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen/CompilerContext.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-12-31 03:13:41 +0800
committerchriseth <chris@ethereum.org>2018-04-12 19:09:38 +0800
commit7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57 (patch)
tree0f3ab32a927c35f24df13fe0072f5a011e15889a /libsolidity/codegen/CompilerContext.cpp
parentae1d040285d97c2be0eb9d3e94a983975459f879 (diff)
downloaddexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.tar.gz
dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.tar.zst
dexon-solidity-7a9ee69e986cf58c8b2a6cabec2c59b0eb2fbb57.zip
Bubble up error messages.
Diffstat (limited to 'libsolidity/codegen/CompilerContext.cpp')
-rw-r--r--libsolidity/codegen/CompilerContext.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp
index 47333046..2cd256f3 100644
--- a/libsolidity/codegen/CompilerContext.cpp
+++ b/libsolidity/codegen/CompilerContext.cpp
@@ -262,12 +262,20 @@ CompilerContext& CompilerContext::appendRevert()
return *this << u256(0) << u256(0) << Instruction::REVERT;
}
-CompilerContext& CompilerContext::appendConditionalRevert()
-{
- *this << Instruction::ISZERO;
- eth::AssemblyItem afterTag = appendConditionalJump();
- appendRevert();
- *this << afterTag;
+CompilerContext& CompilerContext::appendConditionalRevert(bool _forwardReturnData)
+{
+ if (_forwardReturnData)
+ appendInlineAssembly(R"({
+ if condition {
+ returndatacopy(0, 0, returndatasize())
+ revert(0, returndatasize())
+ }
+ })", {"condition"});
+ else
+ appendInlineAssembly(R"({
+ if condition { revert(0, 0) }
+ })", {"condition"});
+ *this << Instruction::POP;
return *this;
}