aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/codegen
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-03-03 00:26:16 +0800
committerchriseth <chris@ethereum.org>2018-04-12 19:09:38 +0800
commitfcb7a2721636a9a2f05659610fc05fa8513f745d (patch)
treebfca3a59be22aae9585c7d41e569592dfcc044ab /libsolidity/codegen
parent42c4c78390b6330e8bc4558b4be5d580251abcba (diff)
downloaddexon-solidity-fcb7a2721636a9a2f05659610fc05fa8513f745d.tar
dexon-solidity-fcb7a2721636a9a2f05659610fc05fa8513f745d.tar.gz
dexon-solidity-fcb7a2721636a9a2f05659610fc05fa8513f745d.tar.bz2
dexon-solidity-fcb7a2721636a9a2f05659610fc05fa8513f745d.tar.lz
dexon-solidity-fcb7a2721636a9a2f05659610fc05fa8513f745d.tar.xz
dexon-solidity-fcb7a2721636a9a2f05659610fc05fa8513f745d.tar.zst
dexon-solidity-fcb7a2721636a9a2f05659610fc05fa8513f745d.zip
Only forward returndata if EVM version supports it.
Diffstat (limited to 'libsolidity/codegen')
-rw-r--r--libsolidity/codegen/CompilerContext.cpp2
-rw-r--r--libsolidity/codegen/CompilerContext.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp
index 2cd256f3..a35eea73 100644
--- a/libsolidity/codegen/CompilerContext.cpp
+++ b/libsolidity/codegen/CompilerContext.cpp
@@ -264,7 +264,7 @@ CompilerContext& CompilerContext::appendRevert()
CompilerContext& CompilerContext::appendConditionalRevert(bool _forwardReturnData)
{
- if (_forwardReturnData)
+ if (_forwardReturnData && m_evmVersion.supportsReturndata())
appendInlineAssembly(R"({
if condition {
returndatacopy(0, 0, returndatasize())
diff --git a/libsolidity/codegen/CompilerContext.h b/libsolidity/codegen/CompilerContext.h
index c6f2f3be..098472f7 100644
--- a/libsolidity/codegen/CompilerContext.h
+++ b/libsolidity/codegen/CompilerContext.h
@@ -158,6 +158,8 @@ public:
CompilerContext& appendRevert();
/// Appends a conditional REVERT-call, either forwarding the RETURNDATA or providing the
/// empty string. Consumes the condition.
+ /// If the current EVM version does not support RETURNDATA, uses REVERT but does not forward
+ /// the data.
CompilerContext& appendConditionalRevert(bool _forwardReturnData = false);
/// Appends a JUMP to a specific tag
CompilerContext& appendJumpTo(eth::AssemblyItem const& _tag) { m_asm->appendJump(_tag); return *this; }