From 1b39d3b5d479aead729b765a67dfeaba0031c1ca Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Wed, 30 Mar 2016 13:15:54 -0500 Subject: solAsserts added and some changes rolled back. --- libsolidity/parsing/Token.cpp | 2 +- libsolidity/parsing/Token.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libsolidity/parsing/Token.cpp b/libsolidity/parsing/Token.cpp index 097a6f54..2fbc3886 100644 --- a/libsolidity/parsing/Token.cpp +++ b/libsolidity/parsing/Token.cpp @@ -113,7 +113,7 @@ int Token::parseSize(string::const_iterator _begin, string::const_iterator _end) { try { - unsigned int m = boost::lexical_cast(boost::make_iterator_range(_begin, _end)); + unsigned int m = boost::lexical_cast(boost::make_iterator_range(_begin, _end)); return m; } catch(boost::bad_lexical_cast const&) diff --git a/libsolidity/parsing/Token.h b/libsolidity/parsing/Token.h index e7a7e24c..76c274bb 100644 --- a/libsolidity/parsing/Token.h +++ b/libsolidity/parsing/Token.h @@ -334,7 +334,8 @@ public: std::string name = Token::toString(m_token); if (tokenValue || (firstNumber() == 0 && secondNumber() == 0)) return name; - else if (m_token == Token::FixedMxN || m_token == Token::UFixedMxN) + solAssert(name.size() >= 3, "Token name size should be greater than 3. Should not reach here."); + if (m_token == Token::FixedMxN || m_token == Token::UFixedMxN) return name.substr(0, name.size() - 3) + std::to_string(m_firstNumber) + "x" + std::to_string(m_secondNumber); else return name.substr(0, name.size() - 1) + std::to_string(m_firstNumber); -- cgit