From 96041741517bf3faa963b5bc7e2012052c319db1 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 26 May 2020 10:48:17 +0200 Subject: [PATCH] Rename asCallableFunction. --- libsolidity/analysis/ContractLevelChecker.cpp | 8 ++++---- libsolidity/analysis/OverrideChecker.cpp | 4 ++-- libsolidity/ast/AST.cpp | 6 +++--- libsolidity/ast/Types.cpp | 6 +++--- libsolidity/ast/Types.h | 4 ++-- libsolidity/formal/SMTEncoder.cpp | 4 ++-- tools/solidityUpgrade/Upgrade060.cpp | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libsolidity/analysis/ContractLevelChecker.cpp b/libsolidity/analysis/ContractLevelChecker.cpp index cb8694537..c0fdd9e30 100644 --- a/libsolidity/analysis/ContractLevelChecker.cpp +++ b/libsolidity/analysis/ContractLevelChecker.cpp @@ -41,8 +41,8 @@ bool hasEqualNameAndParameters(T const& _a, B const& _b) { return _a.name() == _b.name() && - FunctionType(_a).asCallableFunction(false)->hasEqualParameterTypes( - *FunctionType(_b).asCallableFunction(false) + FunctionType(_a).asExternallyCallableFunction(false)->hasEqualParameterTypes( + *FunctionType(_b).asExternallyCallableFunction(false) ); } @@ -345,7 +345,7 @@ void ContractLevelChecker::checkExternalTypeClashes(ContractDefinition const& _c // under non error circumstances this should be true if (functionType->interfaceFunctionType()) externalDeclarations[functionType->externalSignature()].emplace_back( - f, functionType->asCallableFunction(false) + f, functionType->asExternallyCallableFunction(false) ); } for (VariableDeclaration const* v: contract->stateVariables()) @@ -355,7 +355,7 @@ void ContractLevelChecker::checkExternalTypeClashes(ContractDefinition const& _c // under non error circumstances this should be true if (functionType->interfaceFunctionType()) externalDeclarations[functionType->externalSignature()].emplace_back( - v, functionType->asCallableFunction(false) + v, functionType->asExternallyCallableFunction(false) ); } } diff --git a/libsolidity/analysis/OverrideChecker.cpp b/libsolidity/analysis/OverrideChecker.cpp index 4cf2ff8f4..06b981139 100644 --- a/libsolidity/analysis/OverrideChecker.cpp +++ b/libsolidity/analysis/OverrideChecker.cpp @@ -311,8 +311,8 @@ Token OverrideProxy::functionKind() const FunctionType const* OverrideProxy::functionType() const { return std::visit(GenericVisitor{ - [&](FunctionDefinition const* _item) { return FunctionType(*_item).asCallableFunction(false); }, - [&](VariableDeclaration const* _item) { return FunctionType(*_item).asCallableFunction(false); }, + [&](FunctionDefinition const* _item) { return FunctionType(*_item).asExternallyCallableFunction(false); }, + [&](VariableDeclaration const* _item) { return FunctionType(*_item).asExternallyCallableFunction(false); }, [&](ModifierDefinition const*) -> FunctionType const* { solAssert(false, "Requested function type of modifier."); return nullptr; } }, m_item); } diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index 3d98ff169..3edb08476 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -340,7 +340,7 @@ TypePointer FunctionDefinition::typeViaContractName() const if (annotation().contract->isLibrary()) { if (isPublic()) - return FunctionType(*this).asCallableFunction(true); + return FunctionType(*this).asExternallyCallableFunction(true); else return TypeProvider::function(*this, FunctionType::Kind::Internal); } @@ -375,7 +375,7 @@ FunctionDefinition const& FunctionDefinition::resolveVirtual( solAssert(!dynamic_cast(*scope()).isLibrary(), ""); - FunctionType const* functionType = TypeProvider::function(*this)->asCallableFunction(false); + FunctionType const* functionType = TypeProvider::function(*this)->asExternallyCallableFunction(false); for (ContractDefinition const* c: _mostDerivedContract.annotation().linearizedBaseContracts) { @@ -386,7 +386,7 @@ FunctionDefinition const& FunctionDefinition::resolveVirtual( if ( function->name() == name() && !function->isConstructor() && - FunctionType(*function).asCallableFunction(false)->hasEqualParameterTypes(*functionType) + FunctionType(*function).asExternallyCallableFunction(false)->hasEqualParameterTypes(*functionType) ) return *function; } diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index c25226379..de7b03153 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -370,7 +370,7 @@ MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition seenFunctions.insert(function); if (function->parameters().empty()) continue; - FunctionTypePointer fun = FunctionType(*function, FunctionType::Kind::External).asCallableFunction(true, true); + FunctionTypePointer fun = FunctionType(*function, FunctionType::Kind::External).asExternallyCallableFunction(true, true); if (_type.isImplicitlyConvertibleTo(*fun->selfType())) members.emplace_back(function->name(), fun, function); } @@ -2058,7 +2058,7 @@ MemberList::MemberMap ContractType::nativeMembers(ContractDefinition const* _con for (auto const& it: m_contract.interfaceFunctions()) members.emplace_back( it.second->declaration().name(), - it.second->asCallableFunction(m_contract.isLibrary()), + it.second->asExternallyCallableFunction(m_contract.isLibrary()), &it.second->declaration() ); } @@ -3427,7 +3427,7 @@ TypePointer FunctionType::copyAndSetCallOptions(bool _setGas, bool _setValue, bo ); } -FunctionTypePointer FunctionType::asCallableFunction(bool _inLibrary, bool _bound) const +FunctionTypePointer FunctionType::asExternallyCallableFunction(bool _inLibrary, bool _bound) const { if (_bound) solAssert(!m_parameterTypes.empty(), ""); diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 120b1a42f..4c6885b82 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -1290,11 +1290,11 @@ public: /// @returns a copy of this function type where the location of reference types is changed /// from CallData to Memory. This is the type that would be used when the function is - /// called, as opposed to the parameter types that are available inside the function body. + /// called externally, as opposed to the parameter types that are available inside the function body. /// Also supports variants to be used for library or bound calls. /// @param _inLibrary if true, uses DelegateCall as location. /// @param _bound if true, the function type is set to be bound. - FunctionTypePointer asCallableFunction(bool _inLibrary, bool _bound = false) const; + FunctionTypePointer asExternallyCallableFunction(bool _inLibrary, bool _bound = false) const; protected: std::vector> makeStackItems() const override; diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index a8e0e32b7..99aa6195f 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -74,8 +74,8 @@ bool SMTEncoder::visit(ContractDefinition const& _contract) if ( function->name() == baseFunction->name() && function->kind() == baseFunction->kind() && - FunctionType(*function).asCallableFunction(false)-> - hasEqualParameterTypes(*FunctionType(*baseFunction).asCallableFunction(false)) + FunctionType(*function).asExternallyCallableFunction(false)-> + hasEqualParameterTypes(*FunctionType(*baseFunction).asExternallyCallableFunction(false)) ) { overridden = true; diff --git a/tools/solidityUpgrade/Upgrade060.cpp b/tools/solidityUpgrade/Upgrade060.cpp index f5fc4bdf5..30214ddfc 100644 --- a/tools/solidityUpgrade/Upgrade060.cpp +++ b/tools/solidityUpgrade/Upgrade060.cpp @@ -139,8 +139,8 @@ void OverridingFunction::endVisit(ContractDefinition const& _contract) for (auto [begin, end] = inheritedFunctions.equal_range(proxy); begin != end; begin++) { auto& super = (*begin); - auto functionType = FunctionType(*function).asCallableFunction(false); - auto superType = super.functionType()->asCallableFunction(false); + auto functionType = FunctionType(*function).asExternallyCallableFunction(false); + auto superType = super.functionType()->asExternallyCallableFunction(false); if (functionType && functionType->hasEqualParameterTypes(*superType)) {