mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simplify patterns.
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include <libyul/AsmDataForward.h>
|
||||
#include <libyul/AsmData.h>
|
||||
|
||||
#include <libdevcore/CommonData.h>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <functional>
|
||||
@@ -85,7 +87,7 @@ enum class PatternKind
|
||||
class Pattern
|
||||
{
|
||||
public:
|
||||
using Builtins = dev::eth::EVMBuiltins;
|
||||
using Builtins = dev::eth::EVMBuiltins<Pattern>;
|
||||
static constexpr size_t WordSize = 256;
|
||||
using Word = dev::u256;
|
||||
|
||||
@@ -93,10 +95,12 @@ public:
|
||||
Pattern(PatternKind _kind = PatternKind::Any): m_kind(_kind) {}
|
||||
// Matches a specific constant value.
|
||||
Pattern(unsigned _value): Pattern(dev::u256(_value)) {}
|
||||
Pattern(int _value): Pattern(dev::u256(_value)) {}
|
||||
Pattern(long unsigned _value): Pattern(dev::u256(_value)) {}
|
||||
// Matches a specific constant value.
|
||||
Pattern(dev::u256 const& _value): m_kind(PatternKind::Constant), m_data(std::make_shared<dev::u256>(_value)) {}
|
||||
// Matches a given instruction with given arguments
|
||||
Pattern(dev::eth::Instruction _instruction, std::vector<Pattern> const& _arguments = {});
|
||||
Pattern(dev::eth::Instruction _instruction, std::initializer_list<Pattern> _arguments = {});
|
||||
/// Sets this pattern to be part of the match group with the identifier @a _group.
|
||||
/// Inside one rule, all patterns in the same match group have to match expressions from the
|
||||
/// same expression equivalence class.
|
||||
|
||||
Reference in New Issue
Block a user