aboutsummaryrefslogtreecommitdiffstats
path: root/Types.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-10 01:45:00 +0800
committerChristian <c@ethdev.com>2015-02-12 18:33:09 +0800
commit1369337808ef5d2e4394336eec78f0cff406d55c (patch)
treeafc2d21ec60f1d3b849753308d35e8dab7c8bc8c /Types.h
parent2119a758b314848faa268a74dd218189725676c0 (diff)
downloaddexon-solidity-1369337808ef5d2e4394336eec78f0cff406d55c.tar.gz
dexon-solidity-1369337808ef5d2e4394336eec78f0cff406d55c.tar.zst
dexon-solidity-1369337808ef5d2e4394336eec78f0cff406d55c.zip
Introduced byte array type.
Diffstat (limited to 'Types.h')
-rw-r--r--Types.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/Types.h b/Types.h
index 05090c7a..927ca290 100644
--- a/Types.h
+++ b/Types.h
@@ -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