From ef8355da7f301253303743187d00498791399ab3 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 24 Aug 2017 14:50:05 +0100 Subject: Remove fallthrough from literal parsing --- libsolidity/parsing/Parser.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index ddfdb667..2f28db3e 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1309,18 +1309,21 @@ ASTPointer Parser::parsePrimaryExpression() Literal::SubDenomination subdenomination = static_cast(m_scanner->currentToken()); m_scanner->next(); expression = nodeFactory.createNode(token, literal, subdenomination); - break; } - if (Token::isTimeSubdenomination(m_scanner->peekNextToken())) + else if (Token::isTimeSubdenomination(m_scanner->peekNextToken())) { ASTPointer literal = getLiteralAndAdvance(); nodeFactory.markEndPosition(); Literal::SubDenomination subdenomination = static_cast(m_scanner->currentToken()); m_scanner->next(); expression = nodeFactory.createNode(token, literal, subdenomination); - break; } - // fall-through + else + { + nodeFactory.markEndPosition(); + expression = nodeFactory.createNode(token, getLiteralAndAdvance()); + } + break; case Token::StringLiteral: nodeFactory.markEndPosition(); expression = nodeFactory.createNode(token, getLiteralAndAdvance()); @@ -1357,9 +1360,9 @@ ASTPointer Parser::parsePrimaryExpression() } nodeFactory.markEndPosition(); expectToken(oppositeToken); - return nodeFactory.createNode(components, isArray); + expression = nodeFactory.createNode(components, isArray); + break; } - default: if (Token::isElementaryTypeName(token)) { -- cgit