mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6175 from ethereum/asm-parser-cleanup
Use currentToken()/advance() helpers from ParserBase consistently in AsmParser
This commit is contained in:
commit
eb5bde95b3
@ -79,7 +79,7 @@ Statement Parser::parseStatement()
|
|||||||
case Token::If:
|
case Token::If:
|
||||||
{
|
{
|
||||||
If _if = createWithLocation<If>();
|
If _if = createWithLocation<If>();
|
||||||
m_scanner->next();
|
advance();
|
||||||
_if.condition = make_unique<Expression>(parseExpression());
|
_if.condition = make_unique<Expression>(parseExpression());
|
||||||
_if.body = parseBlock();
|
_if.body = parseBlock();
|
||||||
return Statement{move(_if)};
|
return Statement{move(_if)};
|
||||||
@ -87,15 +87,15 @@ Statement Parser::parseStatement()
|
|||||||
case Token::Switch:
|
case Token::Switch:
|
||||||
{
|
{
|
||||||
Switch _switch = createWithLocation<Switch>();
|
Switch _switch = createWithLocation<Switch>();
|
||||||
m_scanner->next();
|
advance();
|
||||||
_switch.expression = make_unique<Expression>(parseExpression());
|
_switch.expression = make_unique<Expression>(parseExpression());
|
||||||
while (m_scanner->currentToken() == Token::Case)
|
while (currentToken() == Token::Case)
|
||||||
_switch.cases.emplace_back(parseCase());
|
_switch.cases.emplace_back(parseCase());
|
||||||
if (m_scanner->currentToken() == Token::Default)
|
if (currentToken() == Token::Default)
|
||||||
_switch.cases.emplace_back(parseCase());
|
_switch.cases.emplace_back(parseCase());
|
||||||
if (m_scanner->currentToken() == Token::Default)
|
if (currentToken() == Token::Default)
|
||||||
fatalParserError("Only one default case allowed.");
|
fatalParserError("Only one default case allowed.");
|
||||||
else if (m_scanner->currentToken() == Token::Case)
|
else if (currentToken() == Token::Case)
|
||||||
fatalParserError("Case not allowed after default case.");
|
fatalParserError("Case not allowed after default case.");
|
||||||
if (_switch.cases.empty())
|
if (_switch.cases.empty())
|
||||||
fatalParserError("Switch statement without any cases.");
|
fatalParserError("Switch statement without any cases.");
|
||||||
@ -224,11 +224,11 @@ Case Parser::parseCase()
|
|||||||
{
|
{
|
||||||
RecursionGuard recursionGuard(*this);
|
RecursionGuard recursionGuard(*this);
|
||||||
Case _case = createWithLocation<Case>();
|
Case _case = createWithLocation<Case>();
|
||||||
if (m_scanner->currentToken() == Token::Default)
|
if (currentToken() == Token::Default)
|
||||||
m_scanner->next();
|
advance();
|
||||||
else if (m_scanner->currentToken() == Token::Case)
|
else if (currentToken() == Token::Case)
|
||||||
{
|
{
|
||||||
m_scanner->next();
|
advance();
|
||||||
ElementaryOperation literal = parseElementaryOperation();
|
ElementaryOperation literal = parseElementaryOperation();
|
||||||
if (literal.type() != typeid(Literal))
|
if (literal.type() != typeid(Literal))
|
||||||
fatalParserError("Literal expected.");
|
fatalParserError("Literal expected.");
|
||||||
|
Loading…
Reference in New Issue
Block a user