From e0b178e1c51fad4c405e79e1661a6e4692f17ee8 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 30 Apr 2018 12:23:30 +0100 Subject: Disable FixedBytesType(0) aka bytes0 --- libsolidity/ast/Types.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 425e5045..63724ca0 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1283,8 +1283,10 @@ shared_ptr FixedBytesType::smallestTypeForLiteral(string const& FixedBytesType::FixedBytesType(int _bytes): m_bytes(_bytes) { - solAssert(m_bytes >= 0 && m_bytes <= 32, - "Invalid byte number for fixed bytes type: " + dev::toString(m_bytes)); + solAssert( + m_bytes > 0 && m_bytes <= 32, + "Invalid byte number for fixed bytes type: " + dev::toString(m_bytes) + ); } bool FixedBytesType::isImplicitlyConvertibleTo(Type const& _convertTo) const -- cgit From 548bf2ff2812cc2fe43f60e915fd62ad9f3cbf87 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Mon, 30 Apr 2018 14:35:26 +0100 Subject: Remove unused function smallestTypeForLiteral --- libsolidity/ast/Types.cpp | 7 ------- libsolidity/ast/Types.h | 4 ---- 2 files changed, 11 deletions(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 63724ca0..0ff1dc2e 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -1274,13 +1274,6 @@ bool StringLiteralType::isValidUTF8() const return dev::validateUTF8(m_value); } -shared_ptr FixedBytesType::smallestTypeForLiteral(string const& _literal) -{ - if (_literal.length() <= 32) - return make_shared(_literal.length()); - return shared_ptr(); -} - FixedBytesType::FixedBytesType(int _bytes): m_bytes(_bytes) { solAssert( diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 345f84a1..9af333da 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -502,10 +502,6 @@ class FixedBytesType: public Type public: virtual Category category() const override { return Category::FixedBytes; } - /// @returns the smallest bytes type for the given literal or an empty pointer - /// if no type fits. - static std::shared_ptr smallestTypeForLiteral(std::string const& _literal); - explicit FixedBytesType(int _bytes); virtual bool isImplicitlyConvertibleTo(Type const& _convertTo) const override; -- cgit