mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replace boost:variant with std::variant in StandardCompiler
This commit is contained in:
parent
5a6c7ad65f
commit
76dfda7c1c
@ -32,7 +32,7 @@
|
||||
#include <libsolutil/Keccak256.h>
|
||||
|
||||
#include <boost/algorithm/cxx11/any_of.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
@ -491,7 +491,7 @@ std::optional<Json::Value> checkOutputSelection(Json::Value const& _outputSelect
|
||||
}
|
||||
/// Validates the optimizer settings and returns them in a parsed object.
|
||||
/// On error returns the json-formatted error message.
|
||||
boost::variant<OptimiserSettings, Json::Value> parseOptimizerSettings(Json::Value const& _jsonInput)
|
||||
std::variant<OptimiserSettings, Json::Value> parseOptimizerSettings(Json::Value const& _jsonInput)
|
||||
{
|
||||
if (auto result = checkOptimizerKeys(_jsonInput))
|
||||
return *result;
|
||||
@ -552,7 +552,7 @@ boost::variant<OptimiserSettings, Json::Value> parseOptimizerSettings(Json::Valu
|
||||
|
||||
}
|
||||
|
||||
boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler::parseInput(Json::Value const& _input)
|
||||
std::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler::parseInput(Json::Value const& _input)
|
||||
{
|
||||
InputsAndSettings ret;
|
||||
|
||||
@ -740,10 +740,10 @@ boost::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompile
|
||||
if (settings.isMember("optimizer"))
|
||||
{
|
||||
auto optimiserSettings = parseOptimizerSettings(settings["optimizer"]);
|
||||
if (optimiserSettings.type() == typeid(Json::Value))
|
||||
return boost::get<Json::Value>(std::move(optimiserSettings)); // was an error
|
||||
if (std::holds_alternative<Json::Value>(optimiserSettings))
|
||||
return std::get<Json::Value>(std::move(optimiserSettings)); // was an error
|
||||
else
|
||||
ret.optimiserSettings = boost::get<OptimiserSettings>(std::move(optimiserSettings));
|
||||
ret.optimiserSettings = std::get<OptimiserSettings>(std::move(optimiserSettings));
|
||||
}
|
||||
|
||||
Json::Value jsonLibraries = settings.get("libraries", Json::Value(Json::objectValue));
|
||||
@ -1155,9 +1155,9 @@ Json::Value StandardCompiler::compile(Json::Value const& _input) noexcept
|
||||
try
|
||||
{
|
||||
auto parsed = parseInput(_input);
|
||||
if (parsed.type() == typeid(Json::Value))
|
||||
return boost::get<Json::Value>(std::move(parsed));
|
||||
InputsAndSettings settings = boost::get<InputsAndSettings>(std::move(parsed));
|
||||
if (std::holds_alternative<Json::Value>(parsed))
|
||||
return std::get<Json::Value>(std::move(parsed));
|
||||
InputsAndSettings settings = std::get<InputsAndSettings>(std::move(parsed));
|
||||
if (settings.language == "Solidity")
|
||||
return compileSolidity(std::move(settings));
|
||||
else if (settings.language == "Yul")
|
||||
|
@ -24,9 +24,9 @@
|
||||
|
||||
#include <libsolidity/interface/CompilerStack.h>
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
namespace solidity::frontend
|
||||
{
|
||||
@ -73,7 +73,7 @@ private:
|
||||
|
||||
/// Parses the input json (and potentially invokes the read callback) and either returns
|
||||
/// it in condensed form or an error as a json object.
|
||||
boost::variant<InputsAndSettings, Json::Value> parseInput(Json::Value const& _input);
|
||||
std::variant<InputsAndSettings, Json::Value> parseInput(Json::Value const& _input);
|
||||
|
||||
Json::Value compileSolidity(InputsAndSettings _inputsAndSettings);
|
||||
Json::Value compileYul(InputsAndSettings _inputsAndSettings);
|
||||
|
Loading…
Reference in New Issue
Block a user