diff --git a/libsolidity/ast/TypeProvider.cpp b/libsolidity/ast/TypeProvider.cpp index ce05673e2..10f9291b8 100644 --- a/libsolidity/ast/TypeProvider.cpp +++ b/libsolidity/ast/TypeProvider.cpp @@ -17,7 +17,6 @@ #include #include -#include #include #include @@ -25,18 +24,6 @@ using namespace std; using namespace dev; using namespace solidity; -template -constexpr array createIntegerTypes(IntegerType::Modifier _modifier, index_sequence) -{ - return make_array(IntegerType((static_cast(N) + 1) * 8, _modifier)...); -} - -template -constexpr array createFixedBytesTypes(index_sequence) -{ - return make_array(FixedBytesType(static_cast(N) + 1)...); -} - BoolType const TypeProvider::m_boolType{}; InaccessibleDynamicType const TypeProvider::m_inaccessibleDynamicType{}; ArrayType const TypeProvider::m_bytesStorageType{DataLocation::Storage, false}; @@ -46,9 +33,112 @@ ArrayType const TypeProvider::m_stringMemoryType{DataLocation::Memory, true}; TupleType const TypeProvider::m_emptyTupleType{}; AddressType const TypeProvider::m_payableAddressType{StateMutability::Payable}; AddressType const TypeProvider::m_addressType{StateMutability::NonPayable}; -array const TypeProvider::m_intM{createIntegerTypes(IntegerType::Modifier::Signed, make_index_sequence<32>{})}; -array const TypeProvider::m_uintM{createIntegerTypes(IntegerType::Modifier::Unsigned, make_index_sequence<32>{})}; -array const TypeProvider::m_bytesM{createFixedBytesTypes(make_index_sequence<32>{})}; + +array const TypeProvider::m_intM{ + IntegerType{8 * 1, IntegerType::Modifier::Signed}, + IntegerType{8 * 2, IntegerType::Modifier::Signed}, + IntegerType{8 * 3, IntegerType::Modifier::Signed}, + IntegerType{8 * 4, IntegerType::Modifier::Signed}, + IntegerType{8 * 5, IntegerType::Modifier::Signed}, + IntegerType{8 * 6, IntegerType::Modifier::Signed}, + IntegerType{8 * 7, IntegerType::Modifier::Signed}, + IntegerType{8 * 8, IntegerType::Modifier::Signed}, + IntegerType{8 * 9, IntegerType::Modifier::Signed}, + IntegerType{8 * 10, IntegerType::Modifier::Signed}, + IntegerType{8 * 11, IntegerType::Modifier::Signed}, + IntegerType{8 * 12, IntegerType::Modifier::Signed}, + IntegerType{8 * 13, IntegerType::Modifier::Signed}, + IntegerType{8 * 14, IntegerType::Modifier::Signed}, + IntegerType{8 * 15, IntegerType::Modifier::Signed}, + IntegerType{8 * 16, IntegerType::Modifier::Signed}, + IntegerType{8 * 17, IntegerType::Modifier::Signed}, + IntegerType{8 * 18, IntegerType::Modifier::Signed}, + IntegerType{8 * 19, IntegerType::Modifier::Signed}, + IntegerType{8 * 20, IntegerType::Modifier::Signed}, + IntegerType{8 * 21, IntegerType::Modifier::Signed}, + IntegerType{8 * 22, IntegerType::Modifier::Signed}, + IntegerType{8 * 23, IntegerType::Modifier::Signed}, + IntegerType{8 * 24, IntegerType::Modifier::Signed}, + IntegerType{8 * 25, IntegerType::Modifier::Signed}, + IntegerType{8 * 26, IntegerType::Modifier::Signed}, + IntegerType{8 * 27, IntegerType::Modifier::Signed}, + IntegerType{8 * 28, IntegerType::Modifier::Signed}, + IntegerType{8 * 29, IntegerType::Modifier::Signed}, + IntegerType{8 * 30, IntegerType::Modifier::Signed}, + IntegerType{8 * 31, IntegerType::Modifier::Signed}, + IntegerType{8 * 32, IntegerType::Modifier::Signed} +}; + +array const TypeProvider::m_uintM{ + IntegerType{8 * 1, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 2, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 3, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 4, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 5, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 6, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 7, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 8, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 9, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 10, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 11, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 12, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 13, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 14, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 15, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 16, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 17, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 18, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 19, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 20, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 21, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 22, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 23, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 24, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 25, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 26, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 27, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 28, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 29, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 30, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 31, IntegerType::Modifier::Unsigned}, + IntegerType{8 * 32, IntegerType::Modifier::Unsigned} +}; + +array const TypeProvider::m_bytesM{ + FixedBytesType{1}, + FixedBytesType{2}, + FixedBytesType{3}, + FixedBytesType{4}, + FixedBytesType{5}, + FixedBytesType{6}, + FixedBytesType{7}, + FixedBytesType{8}, + FixedBytesType{9}, + FixedBytesType{10}, + FixedBytesType{11}, + FixedBytesType{12}, + FixedBytesType{13}, + FixedBytesType{14}, + FixedBytesType{15}, + FixedBytesType{16}, + FixedBytesType{17}, + FixedBytesType{18}, + FixedBytesType{19}, + FixedBytesType{20}, + FixedBytesType{21}, + FixedBytesType{22}, + FixedBytesType{23}, + FixedBytesType{24}, + FixedBytesType{25}, + FixedBytesType{26}, + FixedBytesType{27}, + FixedBytesType{28}, + FixedBytesType{29}, + FixedBytesType{30}, + FixedBytesType{31}, + FixedBytesType{32} +}; + array const TypeProvider::m_magicTypes{ MagicType{MagicType::Kind::Block}, MagicType{MagicType::Kind::Message}, diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index eca0bda16..98457a3eb 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -32,7 +32,6 @@ #include #include -#include #include #include @@ -155,9 +154,9 @@ class Type public: Type() = default; Type(Type const&) = delete; - Type(Type&&) = default; + Type(Type&&) = delete; Type& operator=(Type const&) = delete; - Type& operator=(Type&&) = default; + Type& operator=(Type&&) = delete; virtual ~Type() = default; enum class Category @@ -382,12 +381,6 @@ public: Category category() const override { return Category::Integer; } - IntegerType(IntegerType&&) = default; - IntegerType& operator=(IntegerType&&) = default; - IntegerType(IntegerType const&) = default; - IntegerType& operator=(IntegerType const&) = default; - ~IntegerType() = default; - std::string richIdentifier() const override; BoolResult isImplicitlyConvertibleTo(Type const& _convertTo) const override; BoolResult isExplicitlyConvertibleTo(Type const& _convertTo) const override; @@ -578,12 +571,6 @@ public: Category category() const override { return Category::FixedBytes; } - FixedBytesType(FixedBytesType const&) = delete; - FixedBytesType& operator=(FixedBytesType const&) = delete; - FixedBytesType(FixedBytesType&&) = default; - FixedBytesType& operator=(FixedBytesType&&) = default; - ~FixedBytesType() = default; - BoolResult isImplicitlyConvertibleTo(Type const& _convertTo) const override; BoolResult isExplicitlyConvertibleTo(Type const& _convertTo) const override; std::string richIdentifier() const override; @@ -613,8 +600,6 @@ private: class BoolType: public Type { public: - BoolType() = default; - Category category() const override { return Category::Bool; } std::string richIdentifier() const override { return "t_bool"; } TypeResult unaryOperatorResult(Token _operator) const override; @@ -950,8 +935,6 @@ public: explicit TupleType(std::vector _types = {}): m_components(std::move(_types)) {} Category category() const override { return Category::Tuple; } - TupleType(TupleType&&) = default; - TupleType& operator=(TupleType&) = default; BoolResult isImplicitlyConvertibleTo(Type const& _other) const override; std::string richIdentifier() const override; @@ -1398,8 +1381,6 @@ private: class InaccessibleDynamicType: public Type { public: - InaccessibleDynamicType() = default; - Category category() const override { return Category::InaccessibleDynamic; } std::string richIdentifier() const override { return "t_inaccessible"; }