mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replace boost::variant by std::variant in libyul
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <libdevcore/CommonData.h>
|
||||
|
||||
#include <variant>
|
||||
|
||||
using namespace std;
|
||||
using namespace dev;
|
||||
using namespace yul;
|
||||
@@ -35,13 +37,13 @@ using Representation = ConstantOptimiser::Representation;
|
||||
|
||||
namespace
|
||||
{
|
||||
struct MiniEVMInterpreter: boost::static_visitor<u256>
|
||||
struct MiniEVMInterpreter
|
||||
{
|
||||
explicit MiniEVMInterpreter(EVMDialect const& _dialect): m_dialect(_dialect) {}
|
||||
|
||||
u256 eval(Expression const& _expr)
|
||||
{
|
||||
return boost::apply_visitor(*this, _expr);
|
||||
return std::visit(*this, _expr);
|
||||
}
|
||||
|
||||
u256 eval(dev::eth::Instruction _instr, vector<Expression> const& _arguments)
|
||||
@@ -92,9 +94,9 @@ struct MiniEVMInterpreter: boost::static_visitor<u256>
|
||||
|
||||
void ConstantOptimiser::visit(Expression& _e)
|
||||
{
|
||||
if (_e.type() == typeid(Literal))
|
||||
if (holds_alternative<Literal>(_e))
|
||||
{
|
||||
Literal const& literal = boost::get<Literal>(_e);
|
||||
Literal const& literal = std::get<Literal>(_e);
|
||||
if (literal.kind != LiteralKind::Number)
|
||||
return;
|
||||
|
||||
@@ -115,7 +117,7 @@ Expression const* RepresentationFinder::tryFindRepresentation(dev::u256 const& _
|
||||
return nullptr;
|
||||
|
||||
Representation const& repr = findRepresentation(_value);
|
||||
if (repr.expression->type() == typeid(Literal))
|
||||
if (holds_alternative<Literal>(*repr.expression))
|
||||
return nullptr;
|
||||
else
|
||||
return repr.expression.get();
|
||||
|
||||
Reference in New Issue
Block a user