diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-01 20:18:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 20:18:37 +0800 |
commit | ce99a5ce7f98b3dfb86ea8397a5117332af33f2a (patch) | |
tree | 3f3ca4b90842e03951ae0324a1af96ab9d5f7b2c /libsolidity | |
parent | 8d05770e59dd4c383cdcd5f67d2a455be3b09ae1 (diff) | |
parent | 061ea0cfc6b8a7a0950e9764876733391eac6b81 (diff) | |
download | dexon-solidity-ce99a5ce7f98b3dfb86ea8397a5117332af33f2a.tar dexon-solidity-ce99a5ce7f98b3dfb86ea8397a5117332af33f2a.tar.gz dexon-solidity-ce99a5ce7f98b3dfb86ea8397a5117332af33f2a.tar.bz2 dexon-solidity-ce99a5ce7f98b3dfb86ea8397a5117332af33f2a.tar.lz dexon-solidity-ce99a5ce7f98b3dfb86ea8397a5117332af33f2a.tar.xz dexon-solidity-ce99a5ce7f98b3dfb86ea8397a5117332af33f2a.tar.zst dexon-solidity-ce99a5ce7f98b3dfb86ea8397a5117332af33f2a.zip |
Merge pull request #4378 from ethereum/noBaseWithoutArguments
[BREAKING] Disallow calling base constructors without arguments.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index fdc7b434..8f504ffe 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -279,8 +279,6 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont void TypeChecker::checkContractBaseConstructorArguments(ContractDefinition const& _contract) { - bool const v050 = _contract.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::V050); - vector<ContractDefinition const*> const& bases = _contract.annotation().linearizedBaseContracts; // Determine the arguments that are used for the base constructors. @@ -288,27 +286,19 @@ void TypeChecker::checkContractBaseConstructorArguments(ContractDefinition const { if (FunctionDefinition const* constructor = contract->constructor()) for (auto const& modifier: constructor->modifiers()) - { - auto baseContract = dynamic_cast<ContractDefinition const*>(&dereference(*modifier->name())); - if (modifier->arguments()) + if (auto baseContract = dynamic_cast<ContractDefinition const*>(&dereference(*modifier->name()))) { - if (baseContract && baseContract->constructor()) - annotateBaseConstructorArguments(_contract, baseContract->constructor(), modifier.get()); - } - else - { - if (v050) - m_errorReporter.declarationError( - modifier->location(), - "Modifier-style base constructor call without arguments." - ); + if (modifier->arguments()) + { + if (baseContract->constructor()) + annotateBaseConstructorArguments(_contract, baseContract->constructor(), modifier.get()); + } else - m_errorReporter.warning( + m_errorReporter.declarationError( modifier->location(), "Modifier-style base constructor call without arguments." ); } - } for (ASTPointer<InheritanceSpecifier> const& base: contract->baseContracts()) { |