diff options
author | Christian <c@ethdev.com> | 2014-10-31 01:15:25 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-10-31 04:21:25 +0800 |
commit | cb9cb48dc78240717cd4842e75c9314778ebcb10 (patch) | |
tree | 1da710c3f44a0b6d2c7735b23a9da006ad016ec3 /Types.h | |
parent | a5f360273896973a99ad696a427726da875d0473 (diff) | |
download | dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.tar.gz dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.tar.zst dexon-solidity-cb9cb48dc78240717cd4842e75c9314778ebcb10.zip |
Function selector and variable (un)packing.
Diffstat (limited to 'Types.h')
-rw-r--r-- | Types.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -68,6 +68,10 @@ public: virtual bool operator==(Type const& _other) const { return getCategory() == _other.getCategory(); } virtual bool operator!=(Type const& _other) const { return !this->operator ==(_other); } + /// @returns number of bytes used by this type when encoded for CALL, or 0 if the encoding + /// is not a simple big-endian encoding or the type cannot be stored on the stack. + virtual unsigned getCalldataEncodedSize() const { return 0; } + virtual std::string toString() const = 0; virtual u256 literalValue(Literal const&) const { assert(false); } }; @@ -93,6 +97,8 @@ public: virtual bool operator==(Type const& _other) const override; + virtual unsigned getCalldataEncodedSize() const { return m_bits / 8; } + virtual std::string toString() const override; virtual u256 literalValue(Literal const& _literal) const override; @@ -121,6 +127,8 @@ public: return _operator == Token::NOT || _operator == Token::DELETE; } + virtual unsigned getCalldataEncodedSize() const { return 1; } + virtual std::string toString() const override { return "bool"; } virtual u256 literalValue(Literal const& _literal) const override; }; |