mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow implementation of abstract function by constructor of derived class.
This commit is contained in:
parent
a1aee031d1
commit
ab7a22f4a0
@ -32,7 +32,7 @@ using namespace dev;
|
|||||||
using namespace dev::solidity;
|
using namespace dev::solidity;
|
||||||
|
|
||||||
|
|
||||||
bool TypeChecker::checkTypeRequirements(const ContractDefinition& _contract)
|
bool TypeChecker::checkTypeRequirements(ContractDefinition const& _contract)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -174,6 +174,9 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont
|
|||||||
for (ContractDefinition const* contract: boost::adaptors::reverse(_contract.annotation().linearizedBaseContracts))
|
for (ContractDefinition const* contract: boost::adaptors::reverse(_contract.annotation().linearizedBaseContracts))
|
||||||
for (FunctionDefinition const* function: contract->definedFunctions())
|
for (FunctionDefinition const* function: contract->definedFunctions())
|
||||||
{
|
{
|
||||||
|
// Take constructors out of overload hierarchy
|
||||||
|
if (function->isConstructor())
|
||||||
|
continue;
|
||||||
auto& overloads = functions[function->name()];
|
auto& overloads = functions[function->name()];
|
||||||
FunctionTypePointer funType = make_shared<FunctionType>(*function);
|
FunctionTypePointer funType = make_shared<FunctionType>(*function);
|
||||||
auto it = find_if(overloads.begin(), overloads.end(), [&](FunTypeAndFlag const& _funAndFlag)
|
auto it = find_if(overloads.begin(), overloads.end(), [&](FunTypeAndFlag const& _funAndFlag)
|
||||||
|
@ -776,7 +776,10 @@ void ContractCompiler::appendModifierOrFunctionCode()
|
|||||||
{
|
{
|
||||||
solAssert(m_currentFunction, "");
|
solAssert(m_currentFunction, "");
|
||||||
if (m_modifierDepth >= m_currentFunction->modifiers().size())
|
if (m_modifierDepth >= m_currentFunction->modifiers().size())
|
||||||
|
{
|
||||||
|
solAssert(m_currentFunction->isImplemented(), "");
|
||||||
m_currentFunction->body().accept(*this);
|
m_currentFunction->body().accept(*this);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASTPointer<ModifierInvocation> const& modifierInvocation = m_currentFunction->modifiers()[m_modifierDepth];
|
ASTPointer<ModifierInvocation> const& modifierInvocation = m_currentFunction->modifiers()[m_modifierDepth];
|
||||||
|
Loading…
Reference in New Issue
Block a user