diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-10 17:47:12 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-04 21:03:37 +0800 |
commit | c835bcec623d6b6166add70456f5b6bee5c90572 (patch) | |
tree | 7410af7755995eecceebb544ed3523ef4de9a87e /libsolidity/analysis | |
parent | dc0f85c4fb65fa385bb7145c73cc5edaba195483 (diff) | |
download | dexon-solidity-c835bcec623d6b6166add70456f5b6bee5c90572.tar dexon-solidity-c835bcec623d6b6166add70456f5b6bee5c90572.tar.gz dexon-solidity-c835bcec623d6b6166add70456f5b6bee5c90572.tar.bz2 dexon-solidity-c835bcec623d6b6166add70456f5b6bee5c90572.tar.lz dexon-solidity-c835bcec623d6b6166add70456f5b6bee5c90572.tar.xz dexon-solidity-c835bcec623d6b6166add70456f5b6bee5c90572.tar.zst dexon-solidity-c835bcec623d6b6166add70456f5b6bee5c90572.zip |
Replace isFullyImplemented with unimplementedFunctions in ASTAnnotations
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 5fe03aa6..fab410eb 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -113,7 +113,7 @@ bool TypeChecker::visit(ContractDefinition const& _contract) } } if (!function->isImplemented()) - _contract.annotation().isFullyImplemented = false; + _contract.annotation().unimplementedFunctions.push_back(function); } for (auto const& n: _contract.subNodes()) @@ -188,7 +188,6 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont using FunTypeAndFlag = std::pair<FunctionTypePointer, bool>; map<string, vector<FunTypeAndFlag>> functions; - bool allBaseConstructorsImplemented = true; // Search from base to derived for (ContractDefinition const* contract: boost::adaptors::reverse(_contract.annotation().linearizedBaseContracts)) for (FunctionDefinition const* function: contract->definedFunctions()) @@ -199,7 +198,7 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont if (!function->isImplemented()) // Base contract's constructor is not fully implemented, no way to get // out of this. - allBaseConstructorsImplemented = false; + _contract.annotation().unimplementedFunctions.push_back(function); continue; } auto& overloads = functions[function->name()]; @@ -219,16 +218,15 @@ void TypeChecker::checkContractAbstractFunctions(ContractDefinition const& _cont it->second = true; } - if (!allBaseConstructorsImplemented) - _contract.annotation().isFullyImplemented = false; - // Set to not fully implemented if at least one flag is false. for (auto const& it: functions) for (auto const& funAndFlag: it.second) if (!funAndFlag.second) { - _contract.annotation().isFullyImplemented = false; - return; + FunctionDefinition const* function = dynamic_cast<FunctionDefinition const*>(&funAndFlag.first->declaration()); + solAssert(function, ""); + _contract.annotation().unimplementedFunctions.push_back(function); + break; } } @@ -266,7 +264,8 @@ void TypeChecker::checkContractAbstractConstructors(ContractDefinition const& _c } } if (!argumentsNeeded.empty()) - _contract.annotation().isFullyImplemented = false; + for (ContractDefinition const* contract: argumentsNeeded) + _contract.annotation().unimplementedFunctions.push_back(contract->constructor()); } void TypeChecker::checkContractIllegalOverrides(ContractDefinition const& _contract) @@ -1523,7 +1522,7 @@ void TypeChecker::endVisit(NewExpression const& _newExpression) if (!contract) m_errorReporter.fatalTypeError(_newExpression.location(), "Identifier is not a contract."); - if (!contract->annotation().isFullyImplemented) + if (!contract->annotation().unimplementedFunctions.empty()) m_errorReporter.typeError(_newExpression.location(), "Trying to create an instance of an abstract contract."); if (!contract->constructorIsPublic()) m_errorReporter.typeError(_newExpression.location(), "Contract with internal constructor cannot be created directly."); |