diff options
author | chriseth <chris@ethereum.org> | 2018-05-15 19:04:49 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-05-15 20:45:54 +0800 |
commit | dac0029d16ffe31fba2e6241f99893ea9a26926e (patch) | |
tree | 1e68ea5ff7ab7b10bf2bf59195676ff7feac8524 /libsolidity/ast | |
parent | dce62240525035ec7ce6b5d1b76bfeebe1ae9546 (diff) | |
download | dexon-solidity-dac0029d16ffe31fba2e6241f99893ea9a26926e.tar dexon-solidity-dac0029d16ffe31fba2e6241f99893ea9a26926e.tar.gz dexon-solidity-dac0029d16ffe31fba2e6241f99893ea9a26926e.tar.bz2 dexon-solidity-dac0029d16ffe31fba2e6241f99893ea9a26926e.tar.lz dexon-solidity-dac0029d16ffe31fba2e6241f99893ea9a26926e.tar.xz dexon-solidity-dac0029d16ffe31fba2e6241f99893ea9a26926e.tar.zst dexon-solidity-dac0029d16ffe31fba2e6241f99893ea9a26926e.zip |
ABI encoding functions are pure and should be usable in constants.
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/Types.cpp | 6 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index dc548538..60e3183c 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -2865,7 +2865,11 @@ bool FunctionType::isPure() const m_kind == Kind::RIPEMD160 || m_kind == Kind::AddMod || m_kind == Kind::MulMod || - m_kind == Kind::ObjectCreation; + m_kind == Kind::ObjectCreation || + m_kind == Kind::ABIEncode || + m_kind == Kind::ABIEncodePacked || + m_kind == Kind::ABIEncodeWithSelector || + m_kind == Kind::ABIEncodeWithSignature; } TypePointers FunctionType::parseElementaryTypeVector(strings const& _types) diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 6defacfc..4884696d 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -1046,8 +1046,8 @@ public: return *m_declaration; } bool hasDeclaration() const { return !!m_declaration; } - /// @returns true if the result of this function only depends on its arguments - /// and it does not modify the state. + /// @returns true if the result of this function only depends on its arguments, + /// does not modify the state and is a compile-time constant. /// Currently, this will only return true for internal functions like keccak and ecrecover. bool isPure() const; bool isPayable() const { return m_stateMutability == StateMutability::Payable; } |