/*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see .
*/
// SPDX-License-Identifier: GPL-3.0
#include
#include
#include
#include
using namespace solidity;
using namespace solidity::util;
using namespace solidity::frontend::experimental;
IRVariable::IRVariable(std::string _baseName, Type _type):
m_baseName(std::move(_baseName)), m_type(_type)
{
}
IRVariable::IRVariable(VariableDeclaration const& _declaration, Type _type):
IRVariable(IRNames::localVariable(_declaration), _type)
{
solAssert(!_declaration.isStateVariable(), "");
}
IRVariable::IRVariable(Expression const& _expression, Type _type):
IRVariable(IRNames::localVariable(_expression), _type)
{
}
IRVariable IRVariable::part(std::string const&) const
{
// TODO
return IRVariable{"", Type{}};
}
bool IRVariable::hasPart(std::string const&) const
{
// TODO
return false;
}
std::vector IRVariable::stackSlots() const
{
// TODO
return std::vector{};
}
std::string IRVariable::commaSeparatedList() const
{
return joinHumanReadable(stackSlots());
}
std::string IRVariable::commaSeparatedListPrefixed() const
{
return joinHumanReadablePrefixed(stackSlots());
}
std::string IRVariable::name() const
{
// TODO
return m_baseName;
}
IRVariable IRVariable::tupleComponent(size_t) const
{
// TODO
return IRVariable{"", Type{}};
}
std::string IRVariable::suffixedName(std::string const& _suffix) const
{
if (_suffix.empty())
return m_baseName;
else
return m_baseName + '_' + _suffix;
}