diff options
author | Christian <c@ethdev.com> | 2014-11-13 08:12:57 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-14 21:08:14 +0800 |
commit | c560a62352b8ba1a106ec06aedf779df06af3a22 (patch) | |
tree | 325f19538a1239529e68d0126341e0f6aa655ef7 /Types.h | |
parent | 46dd62982084dfe5712292b88047d2a58e0a420e (diff) | |
download | dexon-solidity-c560a62352b8ba1a106ec06aedf779df06af3a22.tar.gz dexon-solidity-c560a62352b8ba1a106ec06aedf779df06af3a22.tar.zst dexon-solidity-c560a62352b8ba1a106ec06aedf779df06af3a22.zip |
Struct types.
Diffstat (limited to 'Types.h')
-rw-r--r-- | Types.h | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -184,9 +184,14 @@ public: virtual bool operator==(Type const& _other) const override; virtual u256 getStorageSize() const; - //@todo it can, if its members can - virtual bool canLiveOutsideStorage() const { return false; } - virtual std::string toString() const override { return "struct{...}"; } + virtual bool canLiveOutsideStorage() const; + virtual std::string toString() const override; + + unsigned getMemberCount() const; + /// Returns the index of the member with name @a _name or unsigned(-1) if it does not exist. + unsigned memberNameToIndex(std::string const& _name) const; + VariableDeclaration const& getMemberByIndex(unsigned _index) const; + u256 getStorageOffsetOfMember(unsigned _index) const; private: StructDefinition const& m_struct; @@ -204,7 +209,7 @@ public: FunctionDefinition const& getFunction() const { return m_function; } virtual bool operator==(Type const& _other) const override; - virtual std::string toString() const override { return "function(...)returns(...)"; } + virtual std::string toString() const override; virtual u256 getStorageSize() const { BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Storage size of non-storable function type requested.")); } virtual bool canLiveOutsideStorage() const { return false; } @@ -223,11 +228,12 @@ public: m_keyType(_keyType), m_valueType(_valueType) {} virtual bool operator==(Type const& _other) const override; - virtual std::string toString() const override { return "mapping(...=>...)"; } + virtual std::string toString() const override; virtual bool canLiveOutsideStorage() const { return false; } std::shared_ptr<Type const> getKeyType() const { return m_keyType; } std::shared_ptr<Type const> getValueType() const { return m_valueType; } + private: std::shared_ptr<Type const> m_keyType; std::shared_ptr<Type const> m_valueType; |