mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Replace push_back with emplace_back where it makes sense
This commit is contained in:
@@ -353,7 +353,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
|
||||
if (j.tag() || j.which() != sp::utree_type::symbol_type)
|
||||
error<InvalidMacroArgs>();
|
||||
auto sr = j.get<sp::basic_string<boost::iterator_range<char const*>, sp::utree_type::symbol_type>>();
|
||||
args.push_back(string(sr.begin(), sr.end()));
|
||||
args.emplace_back(sr.begin(), sr.end());
|
||||
}
|
||||
else if (ii == 3)
|
||||
{
|
||||
@@ -464,9 +464,9 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
|
||||
if (c++)
|
||||
{
|
||||
if (us == "LLL" && c == 1)
|
||||
code.push_back(CodeFragment(i, ns, m_readFile));
|
||||
code.emplace_back(i, ns, m_readFile);
|
||||
else
|
||||
code.push_back(CodeFragment(i, _s, m_readFile));
|
||||
code.emplace_back(i, _s, m_readFile);
|
||||
}
|
||||
auto requireSize = [&](unsigned s) { if (code.size() != s) error<IncorrectParameterCount>(us); };
|
||||
auto requireMinSize = [&](unsigned s) { if (code.size() < s) error<IncorrectParameterCount>(us); };
|
||||
|
||||
+10
-10
@@ -46,22 +46,22 @@ bytes dev::lll::compileLLL(string const& _src, dev::solidity::EVMVersion _evmVer
|
||||
{
|
||||
if (_errors)
|
||||
{
|
||||
_errors->push_back("Parse error.");
|
||||
_errors->push_back(boost::diagnostic_information(_e));
|
||||
_errors->emplace_back("Parse error.");
|
||||
_errors->emplace_back(boost::diagnostic_information(_e));
|
||||
}
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
if (_errors)
|
||||
{
|
||||
_errors->push_back("Parse exception.");
|
||||
_errors->push_back(boost::diagnostic_information(_e));
|
||||
_errors->emplace_back("Parse exception.");
|
||||
_errors->emplace_back(boost::diagnostic_information(_e));
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (_errors)
|
||||
_errors->push_back("Internal compiler exception.");
|
||||
_errors->emplace_back("Internal compiler exception.");
|
||||
}
|
||||
return bytes();
|
||||
}
|
||||
@@ -84,22 +84,22 @@ std::string dev::lll::compileLLLToAsm(std::string const& _src, EVMVersion _evmVe
|
||||
{
|
||||
if (_errors)
|
||||
{
|
||||
_errors->push_back("Parse error.");
|
||||
_errors->push_back(boost::diagnostic_information(_e));
|
||||
_errors->emplace_back("Parse error.");
|
||||
_errors->emplace_back(boost::diagnostic_information(_e));
|
||||
}
|
||||
}
|
||||
catch (std::exception const& _e)
|
||||
{
|
||||
if (_errors)
|
||||
{
|
||||
_errors->push_back("Parse exception.");
|
||||
_errors->push_back(boost::diagnostic_information(_e));
|
||||
_errors->emplace_back("Parse exception.");
|
||||
_errors->emplace_back(boost::diagnostic_information(_e));
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
if (_errors)
|
||||
_errors->push_back("Internal compiler exception.");
|
||||
_errors->emplace_back("Internal compiler exception.");
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user