From 29669c16a2dfcac6dd01f8ea5cde95dadd82b3e9 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Mon, 30 Mar 2015 17:18:38 +0200 Subject: [PATCH] Fix some styling issues and remove comments --- libsolidity/AST.cpp | 18 ++---------------- test/SolidityNameAndTypeResolution.cpp | 6 +++--- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index 2ada73627..db72ea65a 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -136,34 +136,20 @@ void ContractDefinition::checkAbstractFunctions() // Search from base to derived for (ContractDefinition const* contract: boost::adaptors::reverse(getLinearizedBaseContracts())) - { for (ASTPointer const& function: contract->getDefinedFunctions()) { string const& name = function->getName(); if (!function->isFullyImplemented() && functions.count(name) && functions[name]) BOOST_THROW_EXCEPTION(function->createTypeError("Redeclaring an already implemented function as abstract")); - // if (functions.count(name) && !functions[name] && function->isFullyImplemented()) - // functions.insert(make_pair(name, true); - - // if (functions.count(name) && !functions[name] && function->isFullyImplemented) - // functions.insert(make_pair(name, true)); - - // functions.insert(make_pair(name, function->isFullyImplemented())); functions[name] = function->isFullyImplemented(); - - // if (function->isFullyImplemented()) - // full_functions.insert(make_pair(name, function.get())); - // else - // abs_functions.insert(make_pair(name, function.get())); } - } + for (auto const& it: functions) if (!it.second) { setFullyImplemented(false); break; } - } void ContractDefinition::checkIllegalOverrides() const @@ -682,7 +668,7 @@ void NewExpression::checkTypeRequirements() if (!m_contract) BOOST_THROW_EXCEPTION(createTypeError("Identifier is not a contract.")); if (!m_contract->isFullyImplemented()) - BOOST_THROW_EXCEPTION(m_contract->createTypeError("Trying to create an object of an abstract contract.")); + BOOST_THROW_EXCEPTION(m_contract->createTypeError("Trying to create an instance of an abstract contract.")); shared_ptr contractType = make_shared(*m_contract); TypePointers const& parameterTypes = contractType->getConstructorType()->getParameterTypes(); m_type = make_shared(parameterTypes, TypePointers{contractType}, diff --git a/test/SolidityNameAndTypeResolution.cpp b/test/SolidityNameAndTypeResolution.cpp index 8eb83b117..a1f780134 100644 --- a/test/SolidityNameAndTypeResolution.cpp +++ b/test/SolidityNameAndTypeResolution.cpp @@ -384,10 +384,10 @@ BOOST_AUTO_TEST_CASE(create_abstract_contract) ASTPointer sourceUnit; char const* text = R"( contract base { function foo(); } - contract derived { + contract derived { base b; - function foo() { b = new base();} - } + function foo() { b = new base();} + } )"; BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); }