Rename unctionType::bound() to unctionType::boundToType()

This commit is contained in:
wechman
2022-09-28 13:08:32 +02:00
parent c5640fb125
commit 697d279165
8 changed files with 44 additions and 44 deletions
+10 -10
View File
@@ -683,7 +683,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
else
{
FunctionType const& function = *functionType;
if (function.bound())
if (function.boundToType())
solAssert(
function.kind() == FunctionType::Kind::DelegateCall ||
function.kind() == FunctionType::Kind::Internal ||
@@ -708,7 +708,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
bool shortcutTaken = false;
if (auto identifier = dynamic_cast<Identifier const*>(&_functionCall.expression()))
{
solAssert(!function.bound(), "");
solAssert(!function.boundToType(), "");
if (auto functionDef = dynamic_cast<FunctionDefinition const*>(identifier->annotation().referencedDeclaration))
{
// Do not directly visit the identifier, because this way, we can avoid
@@ -728,7 +728,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
}
unsigned parameterSize = CompilerUtils::sizeOnStack(function.parameterTypes());
if (function.bound())
if (function.boundToType())
{
// stack: arg2, ..., argn, label, arg1
unsigned depth = parameterSize + 1;
@@ -977,7 +977,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
argumentType &&
functionType->kind() == FunctionType::Kind::External &&
argumentType->kind() == FunctionType::Kind::External &&
!argumentType->bound(),
!argumentType->boundToType(),
""
);
@@ -1100,7 +1100,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
}
case FunctionType::Kind::ArrayPush:
{
solAssert(function.bound(), "");
solAssert(function.boundToType(), "");
_functionCall.expression().accept(*this);
if (function.parameterTypes().size() == 0)
@@ -1166,7 +1166,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
case FunctionType::Kind::ArrayPop:
{
_functionCall.expression().accept(*this);
solAssert(function.bound(), "");
solAssert(function.boundToType(), "");
solAssert(function.parameterTypes().empty(), "");
ArrayType const* arrayType = dynamic_cast<ArrayType const*>(function.selfType());
solAssert(arrayType && arrayType->dataStoredIn(DataLocation::Storage), "");
@@ -1550,7 +1550,7 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
// Check whether the member is a bound function.
ASTString const& member = _memberAccess.memberName();
if (auto funType = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type))
if (funType->bound())
if (funType->boundToType())
{
acceptAndConvert(_memberAccess.expression(), *funType->selfType(), true);
if (funType->kind() == FunctionType::Kind::Internal)
@@ -2641,14 +2641,14 @@ void ExpressionCompiler::appendExternalFunctionCall(
// function identifier [unless bare]
// contract address
unsigned selfSize = _functionType.bound() ? _functionType.selfType()->sizeOnStack() : 0;
unsigned selfSize = _functionType.boundToType() ? _functionType.selfType()->sizeOnStack() : 0;
unsigned gasValueSize = (_functionType.gasSet() ? 1u : 0u) + (_functionType.valueSet() ? 1u : 0u);
unsigned contractStackPos = m_context.currentToBaseStackOffset(1 + gasValueSize + selfSize + (_functionType.isBareCall() ? 0 : 1));
unsigned gasStackPos = m_context.currentToBaseStackOffset(gasValueSize);
unsigned valueStackPos = m_context.currentToBaseStackOffset(1);
// move self object to top
if (_functionType.bound())
if (_functionType.boundToType())
utils().moveToStackTop(gasValueSize, _functionType.selfType()->sizeOnStack());
auto funKind = _functionType.kind();
@@ -2676,7 +2676,7 @@ void ExpressionCompiler::appendExternalFunctionCall(
// Evaluate arguments.
TypePointers argumentTypes;
TypePointers parameterTypes = _functionType.parameterTypes();
if (_functionType.bound())
if (_functionType.boundToType())
{
argumentTypes.push_back(_functionType.selfType());
parameterTypes.insert(parameterTypes.begin(), _functionType.selfType());
+1 -1
View File
@@ -321,7 +321,7 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc
_sourceType.isImplicitlyConvertibleTo(*m_dataType),
"function item stored but target is not implicitly convertible to source"
);
solAssert(!fun->bound(), "");
solAssert(!fun->boundToType(), "");
if (fun->kind() == FunctionType::Kind::External)
{
solAssert(fun->sizeOnStack() == 2, "");
@@ -1039,7 +1039,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
solAssert(!functionType->takesArbitraryParameters());
vector<string> args;
if (functionType->bound())
if (functionType->boundToType())
args += IRVariable(_functionCall.expression()).part("self").stackSlots();
for (size_t i = 0; i < arguments.size(); ++i)
@@ -1110,7 +1110,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
solAssert(
IRVariable(arg).type() == *functionType &&
functionType->kind() == FunctionType::Kind::External &&
!functionType->bound(),
!functionType->boundToType(),
""
);
define(indexedArgs.emplace_back(m_context.newYulVariable(), *TypeProvider::fixedBytes(32))) <<
@@ -1439,7 +1439,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
}
case FunctionType::Kind::ArrayPop:
{
solAssert(functionType->bound());
solAssert(functionType->boundToType());
solAssert(functionType->parameterTypes().empty());
ArrayType const* arrayType = dynamic_cast<ArrayType const*>(functionType->selfType());
solAssert(arrayType);
@@ -1643,7 +1643,7 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
solAssert(!_functionCall.annotation().tryCall);
solAssert(!functionType->valueSet());
solAssert(!functionType->gasSet());
solAssert(!functionType->bound());
solAssert(!functionType->boundToType());
static map<FunctionType::Kind, std::tuple<unsigned, size_t>> precompiles = {
{FunctionType::Kind::ECRecover, std::make_tuple(1, 0)},
@@ -1709,7 +1709,7 @@ void IRGeneratorForStatements::endVisit(FunctionCallOptions const& _options)
setLocation(_options);
FunctionType const& previousType = dynamic_cast<FunctionType const&>(*_options.expression().annotation().type);
solUnimplementedAssert(!previousType.bound());
solUnimplementedAssert(!previousType.boundToType());
// Copy over existing values.
for (auto const& item: previousType.stackItems())
@@ -1754,7 +1754,7 @@ void IRGeneratorForStatements::endVisit(MemberAccess const& _memberAccess)
auto memberFunctionType = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type);
Type::Category objectCategory = _memberAccess.expression().annotation().type->category();
if (memberFunctionType && memberFunctionType->bound())
if (memberFunctionType && memberFunctionType->boundToType())
{
define(IRVariable(_memberAccess).part("self"), _memberAccess.expression());
solAssert(*_memberAccess.annotation().requiredLookup == VirtualLookup::Static);
@@ -2592,7 +2592,7 @@ void IRGeneratorForStatements::appendExternalFunctionCall(
TypePointers parameterTypes = funType.parameterTypes();
TypePointers argumentTypes;
vector<string> argumentStrings;
if (funType.bound())
if (funType.boundToType())
{
parameterTypes.insert(parameterTypes.begin(), funType.selfType());
argumentTypes.emplace_back(funType.selfType());
@@ -2741,7 +2741,7 @@ void IRGeneratorForStatements::appendBareCall(
{
FunctionType const& funType = dynamic_cast<FunctionType const&>(type(_functionCall.expression()));
solAssert(
!funType.bound() &&
!funType.boundToType() &&
!funType.takesArbitraryParameters() &&
_arguments.size() == 1 &&
funType.parameterTypes().size() == 1, ""