mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add "this" contract's ctor to provided ctors set
- Also properly naming the 2 sets in checkAbstractConstructors() function
This commit is contained in:
parent
0c296cd809
commit
eb84c3171a
13
AST.cpp
13
AST.cpp
@ -166,7 +166,7 @@ void ContractDefinition::checkAbstractConstructors()
|
|||||||
if (constructor)
|
if (constructor)
|
||||||
{
|
{
|
||||||
if (!constructor->getParameters().empty())
|
if (!constructor->getParameters().empty())
|
||||||
argumentsProvided.insert(constructor);
|
argumentsNeeded.insert(constructor);
|
||||||
for (auto const& modifier: constructor->getModifiers())
|
for (auto const& modifier: constructor->getModifiers())
|
||||||
{
|
{
|
||||||
auto baseContract = dynamic_cast<ContractDefinition const*>(
|
auto baseContract = dynamic_cast<ContractDefinition const*>(
|
||||||
@ -174,8 +174,8 @@ void ContractDefinition::checkAbstractConstructors()
|
|||||||
if (baseContract)
|
if (baseContract)
|
||||||
{
|
{
|
||||||
FunctionDefinition const* baseConstructor = baseContract->getConstructor();
|
FunctionDefinition const* baseConstructor = baseContract->getConstructor();
|
||||||
if (argumentsProvided.count(baseConstructor) == 1)
|
if (argumentsNeeded.count(baseConstructor) == 1)
|
||||||
argumentsNeeded.insert(baseConstructor);
|
argumentsProvided.insert(baseConstructor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -186,10 +186,13 @@ void ContractDefinition::checkAbstractConstructors()
|
|||||||
base->getName()->getReferencedDeclaration());
|
base->getName()->getReferencedDeclaration());
|
||||||
solAssert(baseContract, "");
|
solAssert(baseContract, "");
|
||||||
FunctionDefinition const* baseConstructor = baseContract->getConstructor();
|
FunctionDefinition const* baseConstructor = baseContract->getConstructor();
|
||||||
if (argumentsProvided.count(baseConstructor) == 1)
|
if (argumentsNeeded.count(baseConstructor) == 1)
|
||||||
argumentsNeeded.insert(baseConstructor);
|
argumentsProvided.insert(baseConstructor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// add this contract's constructor to the provided too
|
||||||
|
if (getConstructor() && !getConstructor()->getParameters().empty())
|
||||||
|
argumentsProvided.insert(getConstructor());
|
||||||
if (argumentsProvided != argumentsNeeded)
|
if (argumentsProvided != argumentsNeeded)
|
||||||
setFullyImplemented(false);
|
setFullyImplemented(false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user