mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Correctly determine whether base constructor is called without parentheses.
This commit is contained in:
parent
7e5406dd89
commit
061ea0cfc6
@ -286,19 +286,19 @@ void TypeChecker::checkContractBaseConstructorArguments(ContractDefinition const
|
|||||||
{
|
{
|
||||||
if (FunctionDefinition const* constructor = contract->constructor())
|
if (FunctionDefinition const* constructor = contract->constructor())
|
||||||
for (auto const& modifier: constructor->modifiers())
|
for (auto const& modifier: constructor->modifiers())
|
||||||
{
|
if (auto baseContract = dynamic_cast<ContractDefinition const*>(&dereference(*modifier->name())))
|
||||||
auto baseContract = dynamic_cast<ContractDefinition const*>(&dereference(*modifier->name()));
|
|
||||||
if (modifier->arguments())
|
|
||||||
{
|
{
|
||||||
if (baseContract && baseContract->constructor())
|
if (modifier->arguments())
|
||||||
annotateBaseConstructorArguments(_contract, baseContract->constructor(), modifier.get());
|
{
|
||||||
|
if (baseContract->constructor())
|
||||||
|
annotateBaseConstructorArguments(_contract, baseContract->constructor(), modifier.get());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_errorReporter.declarationError(
|
||||||
|
modifier->location(),
|
||||||
|
"Modifier-style base constructor call without arguments."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
m_errorReporter.declarationError(
|
|
||||||
modifier->location(),
|
|
||||||
"Modifier-style base constructor call without arguments."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ASTPointer<InheritanceSpecifier> const& base: contract->baseContracts())
|
for (ASTPointer<InheritanceSpecifier> const& base: contract->baseContracts())
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
// This generated an invalid warning on m1 in some compiler versions.
|
||||||
|
contract A {
|
||||||
|
constructor() m1 public { }
|
||||||
|
modifier m1 { _; }
|
||||||
|
}
|
||||||
|
contract B is A {
|
||||||
|
modifier m2 { _; }
|
||||||
|
constructor() A() m1 m2 public { }
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user