aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-24 21:50:05 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-25 21:22:59 +0800
commitef8355da7f301253303743187d00498791399ab3 (patch)
treeb9bcf9efed416f13b2785d5d503f202ee91a333f
parent1437521df0136fc3654dd74c816d724c50a125ee (diff)
downloaddexon-solidity-ef8355da7f301253303743187d00498791399ab3.tar.gz
dexon-solidity-ef8355da7f301253303743187d00498791399ab3.tar.zst
dexon-solidity-ef8355da7f301253303743187d00498791399ab3.zip
Remove fallthrough from literal parsing
-rw-r--r--libsolidity/parsing/Parser.cpp15
1 files 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<Expression> Parser::parsePrimaryExpression()
Literal::SubDenomination subdenomination = static_cast<Literal::SubDenomination>(m_scanner->currentToken());
m_scanner->next();
expression = nodeFactory.createNode<Literal>(token, literal, subdenomination);
- break;
}
- if (Token::isTimeSubdenomination(m_scanner->peekNextToken()))
+ else if (Token::isTimeSubdenomination(m_scanner->peekNextToken()))
{
ASTPointer<ASTString> literal = getLiteralAndAdvance();
nodeFactory.markEndPosition();
Literal::SubDenomination subdenomination = static_cast<Literal::SubDenomination>(m_scanner->currentToken());
m_scanner->next();
expression = nodeFactory.createNode<Literal>(token, literal, subdenomination);
- break;
}
- // fall-through
+ else
+ {
+ nodeFactory.markEndPosition();
+ expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance());
+ }
+ break;
case Token::StringLiteral:
nodeFactory.markEndPosition();
expression = nodeFactory.createNode<Literal>(token, getLiteralAndAdvance());
@@ -1357,9 +1360,9 @@ ASTPointer<Expression> Parser::parsePrimaryExpression()
}
nodeFactory.markEndPosition();
expectToken(oppositeToken);
- return nodeFactory.createNode<TupleExpression>(components, isArray);
+ expression = nodeFactory.createNode<TupleExpression>(components, isArray);
+ break;
}
-
default:
if (Token::isElementaryTypeName(token))
{