mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Correct style.
This commit is contained in:
parent
62e801ed70
commit
a781bda595
@ -400,42 +400,42 @@ void TypeChecker::checkContractIllegalOverrides(ContractDefinition const& _contr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypeChecker::checkFunctionOverride(FunctionDefinition const& function, FunctionDefinition const& super)
|
void TypeChecker::checkFunctionOverride(FunctionDefinition const& _function, FunctionDefinition const& _super)
|
||||||
{
|
{
|
||||||
FunctionType functionType(function);
|
FunctionType functionType(_function);
|
||||||
FunctionType superType(super);
|
FunctionType superType(_super);
|
||||||
|
|
||||||
if (!functionType.hasEqualParameterTypes(superType))
|
if (!functionType.hasEqualParameterTypes(superType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!function.annotation().superFunction)
|
if (!_function.annotation().superFunction)
|
||||||
function.annotation().superFunction = &super;
|
_function.annotation().superFunction = &_super;
|
||||||
|
|
||||||
if (function.visibility() != super.visibility())
|
if (_function.visibility() != _super.visibility())
|
||||||
{
|
{
|
||||||
// visibility is enforced to be external in interfaces, but a contract can override that with public
|
// visibility is enforced to be external in interfaces, but a contract can override that with public
|
||||||
if (
|
if (
|
||||||
super.inContractKind() == ContractDefinition::ContractKind::Interface &&
|
_super.inContractKind() == ContractDefinition::ContractKind::Interface &&
|
||||||
function.inContractKind() != ContractDefinition::ContractKind::Interface &&
|
_function.inContractKind() != ContractDefinition::ContractKind::Interface &&
|
||||||
function.visibility() == FunctionDefinition::Visibility::Public
|
_function.visibility() == FunctionDefinition::Visibility::Public
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
overrideError(function, super, "Overriding function visibility differs.");
|
overrideError(_function, _super, "Overriding function visibility differs.");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (function.stateMutability() != super.stateMutability())
|
else if (_function.stateMutability() != _super.stateMutability())
|
||||||
overrideError(
|
overrideError(
|
||||||
function,
|
_function,
|
||||||
super,
|
_super,
|
||||||
"Overriding function changes state mutability from \"" +
|
"Overriding function changes state mutability from \"" +
|
||||||
stateMutabilityToString(super.stateMutability()) +
|
stateMutabilityToString(_super.stateMutability()) +
|
||||||
"\" to \"" +
|
"\" to \"" +
|
||||||
stateMutabilityToString(function.stateMutability()) +
|
stateMutabilityToString(_function.stateMutability()) +
|
||||||
"\"."
|
"\"."
|
||||||
);
|
);
|
||||||
|
|
||||||
else if (functionType != superType)
|
else if (functionType != superType)
|
||||||
overrideError(function, super, "Overriding function return types differ.");
|
overrideError(_function, _super, "Overriding function return types differ.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypeChecker::overrideError(FunctionDefinition const& function, FunctionDefinition const& super, string message)
|
void TypeChecker::overrideError(FunctionDefinition const& function, FunctionDefinition const& super, string message)
|
||||||
|
Loading…
Reference in New Issue
Block a user