mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #11339 from ethereum/memoryModelCatch
Respect memory model in forwarding revert inside catch.
This commit is contained in:
commit
7782e8e8b2
@ -3093,7 +3093,7 @@ void IRGeneratorForStatements::handleCatch(TryStatement const& _tryStatement)
|
|||||||
if (_tryStatement.fallbackClause())
|
if (_tryStatement.fallbackClause())
|
||||||
handleCatchFallback(*_tryStatement.fallbackClause());
|
handleCatchFallback(*_tryStatement.fallbackClause());
|
||||||
else
|
else
|
||||||
rethrow();
|
m_code << m_utils.forwardingRevertFunction() << "()\n";
|
||||||
m_code << "}\n";
|
m_code << "}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3115,17 +3115,6 @@ void IRGeneratorForStatements::handleCatchFallback(TryCatchClause const& _fallba
|
|||||||
_fallback.accept(*this);
|
_fallback.accept(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRGeneratorForStatements::rethrow()
|
|
||||||
{
|
|
||||||
if (m_context.evmVersion().supportsReturndata())
|
|
||||||
m_code << R"(
|
|
||||||
returndatacopy(0, 0, returndatasize())
|
|
||||||
revert(0, returndatasize())
|
|
||||||
)"s;
|
|
||||||
else
|
|
||||||
m_code << "revert(0, 0) // rethrow\n"s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IRGeneratorForStatements::revertWithError(
|
void IRGeneratorForStatements::revertWithError(
|
||||||
string const& _signature,
|
string const& _signature,
|
||||||
vector<Type const*> const& _parameterTypes,
|
vector<Type const*> const& _parameterTypes,
|
||||||
|
@ -103,9 +103,6 @@ private:
|
|||||||
void handleCatch(TryStatement const& _tryStatement);
|
void handleCatch(TryStatement const& _tryStatement);
|
||||||
void handleCatchFallback(TryCatchClause const& _fallback);
|
void handleCatchFallback(TryCatchClause const& _fallback);
|
||||||
|
|
||||||
/// Generates code to rethrow an exception.
|
|
||||||
void rethrow();
|
|
||||||
|
|
||||||
/// Generates code to revert with an error. The error arguments are assumed to
|
/// Generates code to revert with an error. The error arguments are assumed to
|
||||||
/// be already evaluated and available in local IRVariables, but not yet
|
/// be already evaluated and available in local IRVariables, but not yet
|
||||||
/// converted.
|
/// converted.
|
||||||
|
Loading…
Reference in New Issue
Block a user