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
+1 -1
View File
@@ -450,7 +450,7 @@ FunctionType const* TypeProvider::function(
)
{
// Can only use this constructor for "arbitraryParameters".
solAssert(!_options.valueSet && !_options.gasSet && !_options.saltSet && !_options.bound);
solAssert(!_options.valueSet && !_options.gasSet && !_options.saltSet && !_options.boundToType);
return createAndGet<FunctionType>(
_parameterTypes,
_returnParameterTypes,
+16 -16
View File
@@ -3004,7 +3004,7 @@ FunctionTypePointer FunctionType::newExpressionType(ContractDefinition const& _c
vector<string> FunctionType::parameterNames() const
{
if (!bound())
if (!boundToType())
return m_parameterNames;
return vector<string>(m_parameterNames.cbegin() + 1, m_parameterNames.cend());
}
@@ -3033,7 +3033,7 @@ TypePointers FunctionType::returnParameterTypesWithoutDynamicTypes() const
TypePointers FunctionType::parameterTypes() const
{
if (!bound())
if (!boundToType())
return m_parameterTypes;
return TypePointers(m_parameterTypes.cbegin() + 1, m_parameterTypes.cend());
}
@@ -3098,7 +3098,7 @@ string FunctionType::richIdentifier() const
id += "value";
if (saltSet())
id += "salt";
if (bound())
if (boundToType())
id += "bound_to" + identifierList(selfType());
return id;
}
@@ -3133,7 +3133,7 @@ BoolResult FunctionType::isImplicitlyConvertibleTo(Type const& _convertTo) const
FunctionType const& convertTo = dynamic_cast<FunctionType const&>(_convertTo);
// These two checks are duplicated in equalExcludingStateMutability, but are added here for error reporting.
if (convertTo.bound() != bound())
if (convertTo.boundToType() != boundToType())
return BoolResult::err("Bound functions can not be converted to non-bound functions.");
if (convertTo.kind() != kind())
@@ -3174,10 +3174,10 @@ TypeResult FunctionType::binaryOperatorResult(Token _operator, Type const* _othe
else if (
kind() == Kind::External &&
sizeOnStack() == 2 &&
!bound() &&
!boundToType() &&
other.kind() == Kind::External &&
other.sizeOnStack() == 2 &&
!other.bound()
!other.boundToType()
)
return commonType(this, _other);
@@ -3262,7 +3262,7 @@ bool FunctionType::nameable() const
{
return
(m_kind == Kind::Internal || m_kind == Kind::External) &&
!bound() &&
!boundToType() &&
!takesArbitraryParameters() &&
!gasSet() &&
!valueSet() &&
@@ -3301,7 +3301,7 @@ vector<tuple<string, Type const*>> FunctionType::makeStackItems() const
break;
case Kind::ArrayPush:
case Kind::ArrayPop:
solAssert(bound(), "");
solAssert(boundToType(), "");
slots = {};
break;
default:
@@ -3314,7 +3314,7 @@ vector<tuple<string, Type const*>> FunctionType::makeStackItems() const
slots.emplace_back("value", TypeProvider::uint256());
if (saltSet())
slots.emplace_back("salt", TypeProvider::fixedBytes(32));
if (bound())
if (boundToType())
slots.emplace_back("self", m_parameterTypes.front());
return slots;
}
@@ -3475,7 +3475,7 @@ TypeResult FunctionType::interfaceType(bool /*_inLibrary*/) const
Type const* FunctionType::mobileType() const
{
if (valueSet() || gasSet() || saltSet() || bound())
if (valueSet() || gasSet() || saltSet() || boundToType())
return nullptr;
// return function without parameter names
@@ -3496,8 +3496,8 @@ bool FunctionType::canTakeArguments(
Type const* _selfType
) const
{
solAssert(!bound() || _selfType, "");
if (bound() && !_selfType->isImplicitlyConvertibleTo(*selfType()))
solAssert(!boundToType() || _selfType, "");
if (boundToType() && !_selfType->isImplicitlyConvertibleTo(*selfType()))
return false;
TypePointers paramTypes = parameterTypes();
std::vector<std::string> const paramNames = parameterNames();
@@ -3576,10 +3576,10 @@ bool FunctionType::equalExcludingStateMutability(FunctionType const& _other) con
if (gasSet() != _other.gasSet() || valueSet() != _other.valueSet() || saltSet() != _other.saltSet())
return false;
if (bound() != _other.bound())
if (boundToType() != _other.boundToType())
return false;
solAssert(!bound() || *selfType() == *_other.selfType(), "");
solAssert(!boundToType() || *selfType() == *_other.selfType(), "");
return true;
}
@@ -3707,7 +3707,7 @@ FunctionTypePointer FunctionType::asBoundFunction() const
solAssert(!valueSet(), "");
solAssert(!saltSet(), "");
Options options = Options::fromFunctionType(*this);
options.bound = true;
options.boundToType = true;
return TypeProvider::function(
m_parameterTypes,
m_returnParameterTypes,
@@ -3762,7 +3762,7 @@ FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary)
Type const* FunctionType::selfType() const
{
solAssert(bound(), "Function is not bound.");
solAssert(boundToType(), "Function is not bound.");
solAssert(m_parameterTypes.size() > 0, "Function has no self type.");
return m_parameterTypes.at(0);
}
+5 -5
View File
@@ -1274,7 +1274,7 @@ public:
bool saltSet = false;
/// true iff the function is called as arg1.fun(arg2, ..., argn).
/// This is achieved through the "using for" directive.
bool bound = false;
bool boundToType = false;
static Options withArbitraryParameters()
{
@@ -1289,7 +1289,7 @@ public:
result.gasSet = _type.gasSet();
result.valueSet = _type.valueSet();
result.saltSet = _type.saltSet();
result.bound = _type.bound();
result.boundToType = _type.boundToType();
return result;
}
};
@@ -1324,7 +1324,7 @@ public:
)
{
// In this constructor, only the "arbitrary Parameters" option should be used.
solAssert(!bound() && !gasSet() && !valueSet() && !saltSet());
solAssert(!boundToType() && !gasSet() && !valueSet() && !saltSet());
}
/// Detailed constructor, use with care.
@@ -1356,7 +1356,7 @@ public:
"Return parameter names list must match return parameter types list!"
);
solAssert(
!bound() || !m_parameterTypes.empty(),
!boundToType() || !m_parameterTypes.empty(),
"Attempted construction of bound function without self type"
);
}
@@ -1473,7 +1473,7 @@ public:
bool gasSet() const { return m_options.gasSet; }
bool valueSet() const { return m_options.valueSet; }
bool saltSet() const { return m_options.saltSet; }
bool bound() const { return m_options.bound; }
bool boundToType() const { return m_options.boundToType; }
/// @returns a copy of this type, where gas or value are set manually. This will never set one
/// of the parameters to false.