mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Assertions that throw InternalCompilerErrors.
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libdevcore/CommonData.h>
|
||||
#include <libsolidity/Utils.h>
|
||||
#include <libsolidity/Types.h>
|
||||
#include <libsolidity/AST.h>
|
||||
|
||||
@@ -34,8 +35,7 @@ namespace solidity
|
||||
|
||||
shared_ptr<Type const> Type::fromElementaryTypeName(Token::Value _typeToken)
|
||||
{
|
||||
if (asserts(Token::isElementaryTypeName(_typeToken)))
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError());
|
||||
solAssert(Token::isElementaryTypeName(_typeToken), "");
|
||||
|
||||
if (Token::INT <= _typeToken && _typeToken <= Token::HASH256)
|
||||
{
|
||||
@@ -120,8 +120,8 @@ IntegerType::IntegerType(int _bits, IntegerType::Modifier _modifier):
|
||||
{
|
||||
if (isAddress())
|
||||
m_bits = 160;
|
||||
if (asserts(m_bits > 0 && m_bits <= 256 && m_bits % 8 == 0))
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid bit number for integer type: " + dev::toString(_bits)));
|
||||
solAssert(m_bits > 0 && m_bits <= 256 && m_bits % 8 == 0,
|
||||
"Invalid bit number for integer type: " + dev::toString(_bits));
|
||||
}
|
||||
|
||||
bool IntegerType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
@@ -215,9 +215,8 @@ shared_ptr<StaticStringType> StaticStringType::smallestTypeForLiteral(string con
|
||||
|
||||
StaticStringType::StaticStringType(int _bytes): m_bytes(_bytes)
|
||||
{
|
||||
if (asserts(m_bytes >= 0 && m_bytes <= 32))
|
||||
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid byte number for static string type: " +
|
||||
dev::toString(m_bytes)));
|
||||
solAssert(m_bytes >= 0 && m_bytes <= 32,
|
||||
"Invalid byte number for static string type: " + dev::toString(m_bytes));
|
||||
}
|
||||
|
||||
bool StaticStringType::isImplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
|
||||
Reference in New Issue
Block a user