|
|
@ -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; |
|
|
@ -275,6 +276,29 @@ public: |
|
|
|
virtual u256 literalValue(Literal const* _literal) const override; |
|
|
|
}; |
|
|
|
|
|
|
|
/**
|
|
|
|
* 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. |
|
|
|
*/ |
|
|
|