diff options
author | chriseth <chris@ethereum.org> | 2018-05-16 16:22:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 16:22:03 +0800 |
commit | 23adea88fdc7eafc5b67b759b4c2418bd6b93aa6 (patch) | |
tree | a648418931273de87ada16443d3c18b739c76d76 /libsolidity/ast | |
parent | 54839fdffbc32f1f918790b1e09143a410bd1c80 (diff) | |
parent | 03f60410c9ad57c90a327ffb6e8b6b722ec9c995 (diff) | |
download | dexon-solidity-23adea88fdc7eafc5b67b759b4c2418bd6b93aa6.tar dexon-solidity-23adea88fdc7eafc5b67b759b4c2418bd6b93aa6.tar.gz dexon-solidity-23adea88fdc7eafc5b67b759b4c2418bd6b93aa6.tar.bz2 dexon-solidity-23adea88fdc7eafc5b67b759b4c2418bd6b93aa6.tar.lz dexon-solidity-23adea88fdc7eafc5b67b759b4c2418bd6b93aa6.tar.xz dexon-solidity-23adea88fdc7eafc5b67b759b4c2418bd6b93aa6.tar.zst dexon-solidity-23adea88fdc7eafc5b67b759b4c2418bd6b93aa6.zip |
Merge pull request #4138 from ethereum/warnVarArgs
Warn when hash functions are used with var arguments
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/Types.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 4884696d..95821634 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -1058,6 +1058,22 @@ public: /// true iff arguments are to be padded to multiples of 32 bytes for external calls bool padArguments() const { return !(m_kind == Kind::SHA3 || m_kind == Kind::SHA256 || m_kind == Kind::RIPEMD160 || m_kind == Kind::ABIEncodePacked); } bool takesArbitraryParameters() const { return m_arbitraryParameters; } + /// true iff the function takes a single bytes parameter and it is passed on without padding. + /// @todo until 0.5.0, this is just a "recommendation". + bool takesSinglePackedBytesParameter() const + { + // @todo add the call kinds here with 0.5.0 and perhaps also log0. + switch (m_kind) + { + case FunctionType::Kind::SHA3: + case FunctionType::Kind::SHA256: + case FunctionType::Kind::RIPEMD160: + return true; + default: + return false; + } + } + bool gasSet() const { return m_gasSet; } bool valueSet() const { return m_valueSet; } bool bound() const { return m_bound; } |