Merge remote-tracking branch 'origin/develop' into develop_060

This commit is contained in:
chriseth
2019-10-28 15:21:49 +01:00
67 changed files with 182 additions and 165 deletions
+3 -3
View File
@@ -34,11 +34,11 @@
#include <libevmasm/Assembly.h>
#include <boost/optional.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <string>
#include <memory>
#include <optional>
#include <string>
using namespace std;
using namespace langutil;
@@ -54,7 +54,7 @@ namespace test
namespace
{
boost::optional<Error> parseAndReturnFirstError(
std::optional<Error> parseAndReturnFirstError(
string const& _source,
bool _assemble = false,
bool _allowWarnings = true,
+1 -1
View File
@@ -42,7 +42,7 @@ map<string, string> requireParsedCBORMetadata(bytes const& _bytecode)
{
bytes cborMetadata = dev::test::onlyMetadata(_bytecode);
BOOST_REQUIRE(!cborMetadata.empty());
boost::optional<map<string, string>> tmp = dev::test::parseCBORMetadata(cborMetadata);
std::optional<map<string, string>> tmp = dev::test::parseCBORMetadata(cborMetadata);
BOOST_REQUIRE(tmp);
return *tmp;
}
+1 -1
View File
@@ -104,7 +104,7 @@ public:
/// @returns the number of instructions in the given bytecode, not taking the metadata hash
/// into account.
size_t numInstructions(bytes const& _bytecode, boost::optional<Instruction> _which = boost::optional<Instruction>{})
size_t numInstructions(bytes const& _bytecode, std::optional<Instruction> _which = std::optional<Instruction>{})
{
bytes realCode = bytecodeSansMetadata(_bytecode);
BOOST_REQUIRE_MESSAGE(!realCode.empty(), "Invalid or missing metadata in bytecode.");
+5 -5
View File
@@ -141,14 +141,14 @@ string functionSignatureFromABI(Json::Value const& _functionABI)
}
boost::optional<dev::solidity::test::ParameterList> ContractABIUtils::parametersFromJsonOutputs(
std::optional<dev::solidity::test::ParameterList> ContractABIUtils::parametersFromJsonOutputs(
ErrorReporter& _errorReporter,
Json::Value const& _contractABI,
string const& _functionSignature
)
{
if (!_contractABI)
return boost::none;
return std::nullopt;
for (auto const& function: _contractABI)
if (_functionSignature == functionSignatureFromABI(function))
@@ -177,17 +177,17 @@ boost::optional<dev::solidity::test::ParameterList> ContractABIUtils::parameters
"Could not convert \"" + type +
"\" to internal ABI type representation. Falling back to default encoding."
);
return boost::none;
return std::nullopt;
}
finalParams += inplaceTypeParams;
inplaceTypeParams.clear();
}
return boost::optional<ParameterList>(finalParams + dynamicTypeParams);
return std::optional<ParameterList>(finalParams + dynamicTypeParams);
}
return boost::none;
return std::nullopt;
}
bool ContractABIUtils::appendTypesFromName(
+1 -1
View File
@@ -42,7 +42,7 @@ public:
/// a list of internal type representations of isoltest.
/// Creates parameters from Contract ABI and is used to generate values for
/// auto-correction during interactive update routine.
static boost::optional<ParameterList> parametersFromJsonOutputs(
static std::optional<ParameterList> parametersFromJsonOutputs(
ErrorReporter& _errorReporter,
Json::Value const& _contractABI,
std::string const& _functionSignature
+1 -1
View File
@@ -24,11 +24,11 @@
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/optional.hpp>
#include <boost/throw_exception.hpp>
#include <fstream>
#include <memory>
#include <optional>
#include <stdexcept>
using namespace dev;
+9 -9
View File
@@ -20,8 +20,8 @@
#include <libdevcore/AnsiColorized.h>
#include <boost/algorithm/string/replace.hpp>
#include <boost/optional/optional.hpp>
#include <optional>
#include <stdexcept>
#include <string>
@@ -124,12 +124,12 @@ string TestFunctionCall::format(
if (!matchesExpectation())
{
boost::optional<ParameterList> abiParams;
std::optional<ParameterList> abiParams;
if (isFailure)
{
if (!output.empty())
abiParams = boost::make_optional(ContractABIUtils::failureParameters(output));
abiParams = ContractABIUtils::failureParameters(output);
}
else
abiParams = ContractABIUtils::parametersFromJsonOutputs(
@@ -139,7 +139,7 @@ string TestFunctionCall::format(
);
string bytesOutput = abiParams ?
BytesUtils::formatRawBytes(output, abiParams.get(), _linePrefix) :
BytesUtils::formatRawBytes(output, abiParams.value(), _linePrefix) :
BytesUtils::formatRawBytes(
output,
ContractABIUtils::defaultParameters(ceil(output.size() / 32)),
@@ -208,7 +208,7 @@ string TestFunctionCall::formatBytesParameters(
}
else
{
boost::optional<ParameterList> abiParams = ContractABIUtils::parametersFromJsonOutputs(
std::optional<ParameterList> abiParams = ContractABIUtils::parametersFromJsonOutputs(
_errorReporter,
m_contractABI,
_signature
@@ -216,17 +216,17 @@ string TestFunctionCall::formatBytesParameters(
if (abiParams)
{
boost::optional<ParameterList> preferredParams = ContractABIUtils::preferredParameters(
std::optional<ParameterList> preferredParams = ContractABIUtils::preferredParameters(
_errorReporter,
_parameters,
abiParams.get(),
abiParams.value(),
_bytes
);
if (preferredParams)
{
ContractABIUtils::overwriteParameters(_errorReporter, preferredParams.get(), abiParams.get());
os << BytesUtils::formatBytesRange(_bytes, preferredParams.get(), _highlight);
ContractABIUtils::overwriteParameters(_errorReporter, preferredParams.value(), abiParams.value());
os << BytesUtils::formatBytesRange(_bytes, preferredParams.value(), _highlight);
}
}
else