mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replace uses of BOOST_THROW_EXCEPTION with assertThrow
Where appropriate.
This commit is contained in:
parent
e2627e2232
commit
991fbd2956
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
#include <libdevcore/IpfsHash.h>
|
#include <libdevcore/IpfsHash.h>
|
||||||
|
|
||||||
|
#include <libdevcore/Assertions.h>
|
||||||
#include <libdevcore/Exceptions.h>
|
#include <libdevcore/Exceptions.h>
|
||||||
#include <libdevcore/picosha2.h>
|
#include <libdevcore/picosha2.h>
|
||||||
#include <libdevcore/CommonData.h>
|
#include <libdevcore/CommonData.h>
|
||||||
@ -55,11 +56,7 @@ string base58Encode(bytes const& _data)
|
|||||||
|
|
||||||
bytes dev::ipfsHash(string _data)
|
bytes dev::ipfsHash(string _data)
|
||||||
{
|
{
|
||||||
if (_data.length() >= 1024 * 256)
|
assertThrow(_data.length() < 1024 * 256, DataTooLong, "IPFS hash for large (chunked) files not yet implemented.");
|
||||||
BOOST_THROW_EXCEPTION(
|
|
||||||
DataTooLong() <<
|
|
||||||
errinfo_comment("Ipfs hash for large (chunked) files not yet implemented.")
|
|
||||||
);
|
|
||||||
|
|
||||||
bytes lengthAsVarint = varintEncoding(_data.size());
|
bytes lengthAsVarint = varintEncoding(_data.size());
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ Json::Value Assembly::assemblyJSON(StringMap const& _sourceCodes) const
|
|||||||
collection.append(createJsonValue("PUSH data", i.location().start, i.location().end, toStringInHex(i.data())));
|
collection.append(createJsonValue("PUSH data", i.location().start, i.location().end, toStringInHex(i.data())));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BOOST_THROW_EXCEPTION(InvalidOpcode());
|
assertThrow(false, InvalidOpcode, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ LinkerObject const& Assembly::assemble() const
|
|||||||
ret.bytecode.push_back((uint8_t)Instruction::JUMPDEST);
|
ret.bytecode.push_back((uint8_t)Instruction::JUMPDEST);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BOOST_THROW_EXCEPTION(InvalidOpcode());
|
assertThrow(false, InvalidOpcode, "Unexpected opcode while assembling.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
BOOST_THROW_EXCEPTION(InvalidOpcode());
|
assertThrow(false, InvalidOpcode, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
int AssemblyItem::arguments() const
|
int AssemblyItem::arguments() const
|
||||||
@ -212,7 +212,7 @@ string AssemblyItem::toAssemblyText() const
|
|||||||
assertThrow(false, AssemblyException, "Invalid assembly item.");
|
assertThrow(false, AssemblyException, "Invalid assembly item.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BOOST_THROW_EXCEPTION(InvalidOpcode());
|
assertThrow(false, InvalidOpcode, "");
|
||||||
}
|
}
|
||||||
if (m_jumpType == JumpType::IntoFunction || m_jumpType == JumpType::OutOfFunction)
|
if (m_jumpType == JumpType::IntoFunction || m_jumpType == JumpType::OutOfFunction)
|
||||||
{
|
{
|
||||||
@ -277,7 +277,7 @@ ostream& dev::eth::operator<<(ostream& _out, AssemblyItem const& _item)
|
|||||||
_out << " ???";
|
_out << " ???";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
BOOST_THROW_EXCEPTION(InvalidOpcode());
|
assertThrow(false, InvalidOpcode, "");
|
||||||
}
|
}
|
||||||
return _out;
|
return _out;
|
||||||
}
|
}
|
||||||
|
@ -158,11 +158,10 @@ AssemblyItems CSECodeGenerator::generateCode(
|
|||||||
for (auto id: {p.first, p.second})
|
for (auto id: {p.first, p.second})
|
||||||
if (unsigned seqNr = m_expressionClasses.representative(id).sequenceNumber)
|
if (unsigned seqNr = m_expressionClasses.representative(id).sequenceNumber)
|
||||||
{
|
{
|
||||||
if (seqNr < _initialSequenceNumber)
|
|
||||||
// Invalid sequenced operation.
|
// Invalid sequenced operation.
|
||||||
// @todo quick fix for now. Proper fix needs to choose representative with higher
|
// @todo quick fix for now. Proper fix needs to choose representative with higher
|
||||||
// sequence number during dependency analysis.
|
// sequence number during dependency analysis.
|
||||||
BOOST_THROW_EXCEPTION(StackTooDeepException());
|
assertThrow(seqNr >= _initialSequenceNumber, StackTooDeepException, "");
|
||||||
sequencedExpressions.insert(make_pair(seqNr, id));
|
sequencedExpressions.insert(make_pair(seqNr, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,12 +221,9 @@ void CSECodeGenerator::addDependencies(Id _c)
|
|||||||
return; // we already computed the dependencies for _c
|
return; // we already computed the dependencies for _c
|
||||||
ExpressionClasses::Expression expr = m_expressionClasses.representative(_c);
|
ExpressionClasses::Expression expr = m_expressionClasses.representative(_c);
|
||||||
assertThrow(expr.item, OptimizerException, "");
|
assertThrow(expr.item, OptimizerException, "");
|
||||||
if (expr.item->type() == UndefinedItem)
|
|
||||||
BOOST_THROW_EXCEPTION(
|
|
||||||
// If this exception happens, we need to find a different way to generate the
|
// If this exception happens, we need to find a different way to generate the
|
||||||
// compound expression.
|
// compound expression.
|
||||||
ItemNotAvailableException() << errinfo_comment("Undefined item requested but not available.")
|
assertThrow(expr.item->type() != UndefinedItem, ItemNotAvailableException, "Undefined item requested but not available.");
|
||||||
);
|
|
||||||
for (Id argument: expr.arguments)
|
for (Id argument: expr.arguments)
|
||||||
{
|
{
|
||||||
addDependencies(argument);
|
addDependencies(argument);
|
||||||
|
@ -207,11 +207,11 @@ void CodeGenerator::assemble(
|
|||||||
}
|
}
|
||||||
catch (StackTooDeepError const& _e)
|
catch (StackTooDeepError const& _e)
|
||||||
{
|
{
|
||||||
BOOST_THROW_EXCEPTION(
|
solAssert(
|
||||||
InternalCompilerError() << errinfo_comment(
|
false,
|
||||||
"Stack too deep when compiling inline assembly" +
|
"Stack too deep when compiling inline assembly" +
|
||||||
(_e.comment() ? ": " + *_e.comment() : ".")
|
(_e.comment() ? ": " + *_e.comment() : ".")
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
solAssert(transform.stackErrors().empty(), "Stack errors present but not thrown.");
|
solAssert(transform.stackErrors().empty(), "Stack errors present but not thrown.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user