diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-08 18:59:55 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-08 19:42:10 +0800 |
commit | 8df89c5d5b349bbf366eaf410b59a9c85c8832ad (patch) | |
tree | 5a908888f2d0380653879f6673907e4ee6eca060 /libsolidity/analysis | |
parent | 1ada48f61e020a32c0c1f41394ded9a83d5ba57e (diff) | |
download | dexon-solidity-8df89c5d5b349bbf366eaf410b59a9c85c8832ad.tar.gz dexon-solidity-8df89c5d5b349bbf366eaf410b59a9c85c8832ad.tar.zst dexon-solidity-8df89c5d5b349bbf366eaf410b59a9c85c8832ad.zip |
Disable unimplemented library functions instead
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index fbdac1c7..6852c13d 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -518,6 +518,8 @@ bool TypeChecker::visit(FunctionDefinition const& _function) _function.body().accept(*this); else if (_function.isConstructor()) m_errorReporter.typeError(_function.location(), "Constructor must be implemented if declared."); + else if (isLibraryFunction && _function.visibility() <= FunctionDefinition::Visibility::Internal) + m_errorReporter.typeError(_function.location(), "Internal library function must be implemented if declared."); return false; } @@ -1403,21 +1405,6 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) else _functionCall.annotation().type = make_shared<TupleType>(functionType->returnParameterTypes()); - // Internal library functions must be implemented, because of inlining rules. - if ( - functionType->kind() == FunctionType::Kind::Internal && - functionType->hasDeclaration() && - dynamic_cast<FunctionDefinition const*>(&functionType->declaration()) - ) - { - FunctionDefinition const* function = dynamic_cast<FunctionDefinition const*>(&functionType->declaration()); - bool isLibraryFunction = - dynamic_cast<ContractDefinition const*>(function->scope()) && - dynamic_cast<ContractDefinition const*>(function->scope())->isLibrary(); - if (!function->isImplemented() && isLibraryFunction) - m_errorReporter.typeError(_functionCall.location(), "Inlined library function is lacking implementation."); - } - TypePointers parameterTypes = functionType->parameterTypes(); if (!functionType->takesArbitraryParameters() && parameterTypes.size() != arguments.size()) { |