Respect memory model in forwarding revert inside catch.

This commit is contained in:
chriseth 2021-05-03 12:19:46 +02:00
parent 996f3d31d5
commit d721bbe504
2 changed files with 1 additions and 15 deletions

View File

@ -3093,7 +3093,7 @@ void IRGeneratorForStatements::handleCatch(TryStatement const& _tryStatement)
if (_tryStatement.fallbackClause())
handleCatchFallback(*_tryStatement.fallbackClause());
else
rethrow();
m_code << m_utils.forwardingRevertFunction() << "()\n";
m_code << "}\n";
}
@ -3115,17 +3115,6 @@ void IRGeneratorForStatements::handleCatchFallback(TryCatchClause const& _fallba
_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(
string const& _signature,
vector<Type const*> const& _parameterTypes,

View File

@ -103,9 +103,6 @@ private:
void handleCatch(TryStatement const& _tryStatement);
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
/// be already evaluated and available in local IRVariables, but not yet
/// converted.