From 1db350b06a8b741a67664cf47696bb3ccfbff406 Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 9 Feb 2015 02:24:57 +0100 Subject: [PATCH] - removed unnesessary braces but one in if statement is still there because of warrning about ambiguous "else" - added marking of position in node factory to the function Conflicts: libsolidity/Parser.cpp --- libsolidity/AST.cpp | 3 --- libsolidity/Parser.cpp | 11 ++++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index dbc326642..79d724fc4 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -60,7 +60,6 @@ void ContractDefinition::checkTypeRequirements() FunctionDefinition const* fallbackFunction = nullptr; for (ASTPointer const& function: getDefinedFunctions()) - { if (function->getName().empty()) { if (fallbackFunction) @@ -72,8 +71,6 @@ void ContractDefinition::checkTypeRequirements() BOOST_THROW_EXCEPTION(fallbackFunction->getParameterList().createTypeError("Fallback function cannot take parameters.")); } } - } - for (ASTPointer const& modifier: getFunctionModifiers()) modifier->checkTypeRequirements(); diff --git a/libsolidity/Parser.cpp b/libsolidity/Parser.cpp index 2f5b18a04..491b5f848 100644 --- a/libsolidity/Parser.cpp +++ b/libsolidity/Parser.cpp @@ -180,7 +180,7 @@ ASTPointer Parser::parseInheritanceSpecifier() Declaration::Visibility Parser::parseVisibilitySpecifier(Token::Value _token) { - Declaration::Visibility visibility = Declaration::Visibility::DEFAULT; + Declaration::Visibility visibility(Declaration::Visibility::DEFAULT); if (_token == Token::PUBLIC) visibility = Declaration::Visibility::PUBLIC; else if (_token == Token::PROTECTED) @@ -278,20 +278,17 @@ ASTPointer Parser::parseVariableDeclaration(VarDeclParserOp isIndexed = true; m_scanner->next(); } + nodeFactory.markEndPosition(); if (_options.allowEmptyName && m_scanner->getCurrentToken() != Token::IDENTIFIER) { identifier = make_shared(""); nodeFactory.setEndPositionFromNode(type); } else - { - nodeFactory.markEndPosition(); identifier = expectIdentifierToken(); - } - nodeFactory.markEndPosition(); return nodeFactory.createNode(type, identifier, - visibility, _options.isStateVariable, - isIndexed); + visibility, _options.isStateVariable, + isIndexed); } ASTPointer Parser::parseModifierDefinition()