mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use assertThrow where possible
This commit is contained in:
parent
1c54ce2a2c
commit
becea47ac3
@ -30,11 +30,11 @@
|
|||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#endif
|
#endif
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include "Exceptions.h"
|
#include "Assertions.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace dev;
|
using namespace dev;
|
||||||
|
|
||||||
|
|
||||||
template <typename _T>
|
template <typename _T>
|
||||||
inline _T contentsGeneric(std::string const& _file)
|
inline _T contentsGeneric(std::string const& _file)
|
||||||
{
|
{
|
||||||
@ -83,8 +83,7 @@ void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDe
|
|||||||
|
|
||||||
ofstream s(_file, ios::trunc | ios::binary);
|
ofstream s(_file, ios::trunc | ios::binary);
|
||||||
s.write(reinterpret_cast<char const*>(_data.data()), _data.size());
|
s.write(reinterpret_cast<char const*>(_data.data()), _data.size());
|
||||||
if (!s)
|
assertThrow(s, FileError, "Could not write to file: " + _file);
|
||||||
BOOST_THROW_EXCEPTION(FileError() << errinfo_comment("Could not write to file: " + _file));
|
|
||||||
DEV_IGNORE_EXCEPTIONS(fs::permissions(_file, fs::owner_read|fs::owner_write));
|
DEV_IGNORE_EXCEPTIONS(fs::permissions(_file, fs::owner_read|fs::owner_write));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,14 +59,11 @@ void Assembly::append(Assembly const& _a)
|
|||||||
|
|
||||||
void Assembly::append(Assembly const& _a, int _deposit)
|
void Assembly::append(Assembly const& _a, int _deposit)
|
||||||
{
|
{
|
||||||
if (_deposit > _a.m_deposit)
|
assertThrow(_deposit <= _a.m_deposit, InvalidDeposit, "");
|
||||||
BOOST_THROW_EXCEPTION(InvalidDeposit());
|
|
||||||
else
|
append(_a);
|
||||||
{
|
while (_deposit++ < _a.m_deposit)
|
||||||
append(_a);
|
append(Instruction::POP);
|
||||||
while (_deposit++ < _a.m_deposit)
|
|
||||||
append(Instruction::POP);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Assembly::bytesRequired(unsigned subTagSize) const
|
unsigned Assembly::bytesRequired(unsigned subTagSize) const
|
||||||
|
Loading…
Reference in New Issue
Block a user