Use move semantics.

This commit is contained in:
chriseth 2019-04-04 17:48:02 +02:00
parent 054c16aa05
commit 0d2ae84081
3 changed files with 5 additions and 5 deletions

View File

@ -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;
} }

View File

@ -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

View File

@ -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(