diff options
Diffstat (limited to 'Types.h')
-rw-r--r-- | Types.h | 32 |
1 files changed, 28 insertions, 4 deletions
@@ -76,9 +76,10 @@ class Type: private boost::noncopyable, public std::enable_shared_from_this<Type public: enum class Category { - Integer, IntegerConstant, Bool, Real, - String, Contract, Struct, Function, - Mapping, Void, TypeType, Modifier, Magic + Integer, IntegerConstant, Bool, Real, String, + ByteArray, Mapping, + Contract, Struct, Function, + Void, TypeType, Modifier, Magic }; ///@{ @@ -263,7 +264,7 @@ class BoolType: public Type { public: BoolType() {} - virtual Category getCategory() const { return Category::Bool; } + virtual Category getCategory() const override { return Category::Bool; } virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; virtual TypePointer binaryOperatorResult(Token::Value _operator, TypePointer const& _other) const override; @@ -276,6 +277,29 @@ public: }; /** + * The type of a byte array, prototype for a general array. + */ +class ByteArrayType: public Type +{ +public: + enum class Location { Storage, CallData, Memory }; + + virtual Category getCategory() const override { return Category::ByteArray; } + ByteArrayType(Location _location, u256 const& _offset, u256 const& _length, bool _dynamicLength): + m_location(_location), m_offset(_offset), m_length(_length), m_dynamicLength(_dynamicLength) {} + virtual bool operator==(const Type& _other) const override; + virtual unsigned getSizeOnStack() const override { return 1; /* TODO */ } + virtual std::string toString() const override { return "bytes"; } + + +private: + Location m_location; + u256 m_offset; + u256 m_length; + bool m_dynamicLength; +}; + +/** * The type of a contract instance, there is one distinct type for each contract definition. */ class ContractType: public Type |