mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use move semantics.
This commit is contained in:
parent
054c16aa05
commit
0d2ae84081
@ -42,11 +42,11 @@ bool Scope::registerVariable(YulString _name, YulType const& _type)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scope::registerFunction(YulString _name, std::vector<YulType> const& _arguments, std::vector<YulType> const& _returns)
|
bool Scope::registerFunction(YulString _name, std::vector<YulType> _arguments, std::vector<YulType> _returns)
|
||||||
{
|
{
|
||||||
if (exists(_name))
|
if (exists(_name))
|
||||||
return false;
|
return false;
|
||||||
identifiers[_name] = Function{_arguments, _returns};
|
identifiers[_name] = Function{std::move(_arguments), std::move(_returns)};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ struct Scope
|
|||||||
bool registerLabel(YulString _name);
|
bool registerLabel(YulString _name);
|
||||||
bool registerFunction(
|
bool registerFunction(
|
||||||
YulString _name,
|
YulString _name,
|
||||||
std::vector<YulType> const& _arguments,
|
std::vector<YulType> _arguments,
|
||||||
std::vector<YulType> const& _returns
|
std::vector<YulType> _returns
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Looks up the identifier in this or super scopes and returns a valid pointer if found
|
/// Looks up the identifier in this or super scopes and returns a valid pointer if found
|
||||||
|
@ -170,7 +170,7 @@ bool ScopeFiller::registerFunction(FunctionDefinition const& _funDef)
|
|||||||
vector<Scope::YulType> returns;
|
vector<Scope::YulType> returns;
|
||||||
for (auto const& _return: _funDef.returnVariables)
|
for (auto const& _return: _funDef.returnVariables)
|
||||||
returns.emplace_back(_return.type.str());
|
returns.emplace_back(_return.type.str());
|
||||||
if (!m_currentScope->registerFunction(_funDef.name, arguments, returns))
|
if (!m_currentScope->registerFunction(_funDef.name, std::move(arguments), std::move(returns)))
|
||||||
{
|
{
|
||||||
//@TODO secondary location
|
//@TODO secondary location
|
||||||
m_errorReporter.declarationError(
|
m_errorReporter.declarationError(
|
||||||
|
Loading…
Reference in New Issue
Block a user