diff options
author | Christian <c@ethdev.com> | 2014-11-22 02:14:56 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-24 04:28:45 +0800 |
commit | 583a315d3d282ab9fd871bb2ea3beded367be6d0 (patch) | |
tree | 8471241f34041fe5aadd7fc0a574fef8c80e2aa8 /Types.h | |
parent | c50cd646ce3b8b6c20da747efee89f9420526cae (diff) | |
download | dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.tar.gz dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.tar.zst dexon-solidity-583a315d3d282ab9fd871bb2ea3beded367be6d0.zip |
Magic variables.
Diffstat (limited to 'Types.h')
-rw-r--r-- | Types.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -73,7 +73,7 @@ class Type: private boost::noncopyable public: enum class Category { - INTEGER, BOOL, REAL, STRING, CONTRACT, STRUCT, FUNCTION, MAPPING, VOID, TYPE + INTEGER, BOOL, REAL, STRING, CONTRACT, STRUCT, FUNCTION, MAPPING, VOID, TYPE, MAGIC }; ///@{ @@ -110,6 +110,9 @@ public: virtual bool canBeStored() const { return true; } /// Returns false if the type cannot live outside the storage, i.e. if it includes some mapping. virtual bool canLiveOutsideStorage() const { return true; } + /// Returns true if the type can be stored as a value (as opposed to a reference) on the stack, + /// i.e. it behaves differently in lvalue context and in value context. + virtual bool isValueType() const { return false; } /// Returns the list of all members of this type. Default implementation: no members. virtual MemberList const& getMembers() const { return EmptyMemberList; } @@ -154,6 +157,9 @@ public: virtual bool operator==(Type const& _other) const override; virtual unsigned getCalldataEncodedSize() const override { return m_bits / 8; } + virtual bool isValueType() const override { return true; } + + virtual MemberList const& getMembers() const { return isAddress() ? AddressMemberList : EmptyMemberList; } virtual std::string toString() const override; virtual u256 literalValue(Literal const& _literal) const override; @@ -166,6 +172,7 @@ public: private: int m_bits; Modifier m_modifier; + static const MemberList AddressMemberList; }; /** @@ -186,6 +193,7 @@ public: } virtual unsigned getCalldataEncodedSize() const { return 1; } + virtual bool isValueType() const override { return true; } virtual std::string toString() const override { return "bool"; } virtual u256 literalValue(Literal const& _literal) const override; |