From eb84c3171aa362c507c7213c937748b9e9f78ca9 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 2 Apr 2015 17:42:43 +0200 Subject: [PATCH] Add "this" contract's ctor to provided ctors set - Also properly naming the 2 sets in checkAbstractConstructors() function --- AST.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/AST.cpp b/AST.cpp index 7f4b8710e..1c12ef5a1 100644 --- a/AST.cpp +++ b/AST.cpp @@ -166,7 +166,7 @@ void ContractDefinition::checkAbstractConstructors() if (constructor) { if (!constructor->getParameters().empty()) - argumentsProvided.insert(constructor); + argumentsNeeded.insert(constructor); for (auto const& modifier: constructor->getModifiers()) { auto baseContract = dynamic_cast( @@ -174,8 +174,8 @@ void ContractDefinition::checkAbstractConstructors() if (baseContract) { FunctionDefinition const* baseConstructor = baseContract->getConstructor(); - if (argumentsProvided.count(baseConstructor) == 1) - argumentsNeeded.insert(baseConstructor); + if (argumentsNeeded.count(baseConstructor) == 1) + argumentsProvided.insert(baseConstructor); } } } @@ -186,10 +186,13 @@ void ContractDefinition::checkAbstractConstructors() base->getName()->getReferencedDeclaration()); solAssert(baseContract, ""); FunctionDefinition const* baseConstructor = baseContract->getConstructor(); - if (argumentsProvided.count(baseConstructor) == 1) - argumentsNeeded.insert(baseConstructor); + if (argumentsNeeded.count(baseConstructor) == 1) + argumentsProvided.insert(baseConstructor); } } + // add this contract's constructor to the provided too + if (getConstructor() && !getConstructor()->getParameters().empty()) + argumentsProvided.insert(getConstructor()); if (argumentsProvided != argumentsNeeded) setFullyImplemented(false); }