mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adding support for recursive functions in MultiUseYulFunctionCollector
This commit is contained in:
parent
93df3d43df
commit
3ede1f1bca
@ -33,8 +33,11 @@ string MultiUseYulFunctionCollector::requestedFunctions()
|
|||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
for (auto const& f: m_requestedFunctions)
|
for (auto const& f: m_requestedFunctions)
|
||||||
|
{
|
||||||
|
solAssert(f.second != "<<STUB<<", "");
|
||||||
// std::map guarantees ascending order when iterating through its keys.
|
// std::map guarantees ascending order when iterating through its keys.
|
||||||
result += f.second;
|
result += f.second;
|
||||||
|
}
|
||||||
m_requestedFunctions.clear();
|
m_requestedFunctions.clear();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -43,9 +46,10 @@ string MultiUseYulFunctionCollector::createFunction(string const& _name, functio
|
|||||||
{
|
{
|
||||||
if (!m_requestedFunctions.count(_name))
|
if (!m_requestedFunctions.count(_name))
|
||||||
{
|
{
|
||||||
|
m_requestedFunctions[_name] = "<<STUB<<";
|
||||||
string fun = _creator();
|
string fun = _creator();
|
||||||
solAssert(!fun.empty(), "");
|
solAssert(!fun.empty(), "");
|
||||||
solAssert(fun.find("function " + _name) != string::npos, "Function not properly named.");
|
solAssert(fun.find("function " + _name + "(") != string::npos, "Function not properly named.");
|
||||||
m_requestedFunctions[_name] = std::move(fun);
|
m_requestedFunctions[_name] = std::move(fun);
|
||||||
}
|
}
|
||||||
return _name;
|
return _name;
|
||||||
|
Loading…
Reference in New Issue
Block a user