mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add reason string for internal reverts
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <libsolidity/codegen/MultiUseYulFunctionCollector.h>
|
||||
|
||||
#include <libsolidity/interface/DebugSettings.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -44,9 +46,11 @@ class YulUtilFunctions
|
||||
public:
|
||||
explicit YulUtilFunctions(
|
||||
langutil::EVMVersion _evmVersion,
|
||||
RevertStrings _revertStrings,
|
||||
std::shared_ptr<MultiUseYulFunctionCollector> _functionCollector
|
||||
):
|
||||
m_evmVersion(_evmVersion),
|
||||
m_revertStrings(_revertStrings),
|
||||
m_functionCollector(std::move(_functionCollector))
|
||||
{}
|
||||
|
||||
@@ -281,6 +285,13 @@ public:
|
||||
/// zero
|
||||
/// signature: (slot, offset) ->
|
||||
std::string storageSetToZeroFunction(Type const& _type);
|
||||
|
||||
/// If revertStrings is debug, @returns inline assembly code that
|
||||
/// stores @param _message in memory position 0 and reverts.
|
||||
/// Otherwise returns "revert(0, 0)".
|
||||
static std::string revertReasonIfDebug(RevertStrings revertStrings, std::string const& _message = "");
|
||||
|
||||
std::string revertReasonIfDebug(std::string const& _message = "");
|
||||
private:
|
||||
/// Special case of conversionFunction - handles everything that does not
|
||||
/// use exactly one variable to hold the value.
|
||||
@@ -289,6 +300,7 @@ private:
|
||||
std::string readFromMemoryOrCalldata(Type const& _type, bool _fromCalldata);
|
||||
|
||||
langutil::EVMVersion m_evmVersion;
|
||||
RevertStrings m_revertStrings;
|
||||
std::shared_ptr<MultiUseYulFunctionCollector> m_functionCollector;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user