Add reason string for internal reverts

This commit is contained in:
Leonardo Alt
2020-02-10 11:57:20 -03:00
parent e8eb1f2d14
commit 36928c7a35
49 changed files with 555 additions and 131 deletions
+12
View File
@@ -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;
};