From 57ada1d69e311f847b4581a0e487aebd1b0e468f Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Fri, 10 Aug 2018 15:13:12 +0200 Subject: Allow mapping arguments and return values in internal library functions. --- libsolidity/analysis/TypeChecker.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index bcc3757a..62216272 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -629,7 +629,14 @@ bool TypeChecker::visit(FunctionDefinition const& _function) } for (ASTPointer const& var: _function.parameters() + _function.returnParameters()) { - if (!type(*var)->canLiveOutsideStorage()) + if ( + !type(*var)->canLiveOutsideStorage() && + !( + isLibraryFunction && + (_function.visibility() <= FunctionDefinition::Visibility::Internal) && + type(*var)->category() == Type::Category::Mapping + ) + ) m_errorReporter.typeError(var->location(), "Type is required to live outside storage."); if (_function.visibility() >= FunctionDefinition::Visibility::Public && !(type(*var)->interfaceType(isLibraryFunction))) m_errorReporter.fatalTypeError(var->location(), "Internal or recursive type is not allowed for public or external functions."); -- cgit