Rename functions.

This commit is contained in:
chriseth 2018-11-29 18:23:58 +01:00
parent d1cc731843
commit b610be4882
2 changed files with 15 additions and 15 deletions

View File

@ -35,16 +35,16 @@ using namespace dev::solidity;
bool ContractLevelChecker::check(ContractDefinition const& _contract) bool ContractLevelChecker::check(ContractDefinition const& _contract)
{ {
checkContractDuplicateFunctions(_contract); checkDuplicateFunctions(_contract);
checkContractDuplicateEvents(_contract); checkDuplicateEvents(_contract);
checkContractIllegalOverrides(_contract); checkIllegalOverrides(_contract);
checkContractAbstractFunctions(_contract); checkAbstractFunctions(_contract);
checkContractBaseConstructorArguments(_contract); checkBaseConstructorArguments(_contract);
return Error::containsOnlyWarnings(m_errorReporter.errors()); return Error::containsOnlyWarnings(m_errorReporter.errors());
} }
void ContractLevelChecker::checkContractDuplicateFunctions(ContractDefinition const& _contract) void ContractLevelChecker::checkDuplicateFunctions(ContractDefinition const& _contract)
{ {
/// Checks that two functions with the same name defined in this contract have different /// Checks that two functions with the same name defined in this contract have different
/// argument types and that there is at most one constructor. /// argument types and that there is at most one constructor.
@ -81,7 +81,7 @@ void ContractLevelChecker::checkContractDuplicateFunctions(ContractDefinition co
findDuplicateDefinitions(functions, "Function with same name and arguments defined twice."); findDuplicateDefinitions(functions, "Function with same name and arguments defined twice.");
} }
void ContractLevelChecker::checkContractDuplicateEvents(ContractDefinition const& _contract) void ContractLevelChecker::checkDuplicateEvents(ContractDefinition const& _contract)
{ {
/// Checks that two events with the same name defined in this contract have different /// Checks that two events with the same name defined in this contract have different
/// argument types /// argument types
@ -126,7 +126,7 @@ void ContractLevelChecker::findDuplicateDefinitions(map<string, vector<T>> const
} }
} }
void ContractLevelChecker::checkContractIllegalOverrides(ContractDefinition const& _contract) void ContractLevelChecker::checkIllegalOverrides(ContractDefinition const& _contract)
{ {
// TODO unify this at a later point. for this we need to put the constness and the access specifier // TODO unify this at a later point. for this we need to put the constness and the access specifier
// into the types // into the types
@ -207,7 +207,7 @@ void ContractLevelChecker::overrideError(FunctionDefinition const& function, Fun
); );
} }
void ContractLevelChecker::checkContractAbstractFunctions(ContractDefinition const& _contract) void ContractLevelChecker::checkAbstractFunctions(ContractDefinition const& _contract)
{ {
// Mapping from name to function definition (exactly one per argument type equality class) and // Mapping from name to function definition (exactly one per argument type equality class) and
// flag to indicate whether it is fully implemented. // flag to indicate whether it is fully implemented.
@ -251,7 +251,7 @@ void ContractLevelChecker::checkContractAbstractFunctions(ContractDefinition con
} }
void ContractLevelChecker::checkContractBaseConstructorArguments(ContractDefinition const& _contract) void ContractLevelChecker::checkBaseConstructorArguments(ContractDefinition const& _contract)
{ {
vector<ContractDefinition const*> const& bases = _contract.annotation().linearizedBaseContracts; vector<ContractDefinition const*> const& bases = _contract.annotation().linearizedBaseContracts;

View File

@ -54,17 +54,17 @@ public:
private: private:
/// Checks that two functions defined in this contract with the same name have different /// Checks that two functions defined in this contract with the same name have different
/// arguments and that there is at most one constructor. /// arguments and that there is at most one constructor.
void checkContractDuplicateFunctions(ContractDefinition const& _contract); void checkDuplicateFunctions(ContractDefinition const& _contract);
void checkContractDuplicateEvents(ContractDefinition const& _contract); void checkDuplicateEvents(ContractDefinition const& _contract);
template <class T> template <class T>
void findDuplicateDefinitions(std::map<std::string, std::vector<T>> const& _definitions, std::string _message); void findDuplicateDefinitions(std::map<std::string, std::vector<T>> const& _definitions, std::string _message);
void checkContractIllegalOverrides(ContractDefinition const& _contract); void checkIllegalOverrides(ContractDefinition const& _contract);
/// Reports a type error with an appropriate message if overridden function signature differs. /// Reports a type error with an appropriate message if overridden function signature differs.
/// Also stores the direct super function in the AST annotations. /// Also stores the direct super function in the AST annotations.
void checkFunctionOverride(FunctionDefinition const& function, FunctionDefinition const& super); void checkFunctionOverride(FunctionDefinition const& function, FunctionDefinition const& super);
void overrideError(FunctionDefinition const& function, FunctionDefinition const& super, std::string message); void overrideError(FunctionDefinition const& function, FunctionDefinition const& super, std::string message);
void checkContractAbstractFunctions(ContractDefinition const& _contract); void checkAbstractFunctions(ContractDefinition const& _contract);
void checkContractBaseConstructorArguments(ContractDefinition const& _contract); void checkBaseConstructorArguments(ContractDefinition const& _contract);
void annotateBaseConstructorArguments( void annotateBaseConstructorArguments(
ContractDefinition const& _currentContract, ContractDefinition const& _currentContract,
FunctionDefinition const* _baseConstructor, FunctionDefinition const* _baseConstructor,