From 7a8a243eef5551189c51c753463683097cf92f94 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 18 Jul 2018 15:46:23 +0200 Subject: Isolate determining the encoding type into its own function. --- libsolidity/analysis/TypeChecker.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'libsolidity/analysis') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index d2fb9281..11de30d5 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -1749,22 +1749,8 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) m_errorReporter.typeError(arguments[i]->location(), "Invalid rational number (too large or division by zero)."); errored = true; } - if (!errored) - { - TypePointer encodingType; - if ( - argType->mobileType() && - argType->mobileType()->interfaceType(false) && - argType->mobileType()->interfaceType(false)->encodingType() - ) - encodingType = argType->mobileType()->interfaceType(false)->encodingType(); - // Structs are fine as long as ABIV2 is activated and we do not do packed encoding. - if (!encodingType || ( - dynamic_cast(encodingType.get()) && - !(abiEncodeV2 && functionType->padArguments()) - )) - m_errorReporter.typeError(arguments[i]->location(), "This type cannot be encoded."); - } + if (!errored && !argType->fullEncodingType(false, abiEncodeV2, !functionType->padArguments())) + m_errorReporter.typeError(arguments[i]->location(), "This type cannot be encoded."); } else if (!type(*arguments[i])->isImplicitlyConvertibleTo(*parameterTypes[i])) { -- cgit v1.2.3