diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-27 04:00:08 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-05-27 04:02:31 +0800 |
commit | 48f58aa3f9b4d8962b2c6f1bd7967b119893a889 (patch) | |
tree | 3823c4389ca2d8f782e28dc0958cf8808036509a /libsolidity | |
parent | 9337003d5e623cd52c55001222b629543c859cd7 (diff) | |
download | dexon-solidity-48f58aa3f9b4d8962b2c6f1bd7967b119893a889.tar.gz dexon-solidity-48f58aa3f9b4d8962b2c6f1bd7967b119893a889.tar.zst dexon-solidity-48f58aa3f9b4d8962b2c6f1bd7967b119893a889.zip |
Remove duplicate code
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/parsing/Parser.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index 470586cf..dca49360 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -1442,21 +1442,20 @@ Token::Value Parser::expectAssignmentOperator() Token::Value op = m_scanner->currentToken(); if (!Token::isAssignmentOp(op)) { + string tokenName; if (Token::isElementaryTypeName(op)) //for the sake of accuracy in reporting { ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); - fatalParserError( - string("Expected assignment operator, got '") + - elemTypeName.toString() + - string("'") - ); + tokenName = elemTypeName.toString(); } else - fatalParserError( - string("Expected assignment operator, got '") + - string(Token::name(m_scanner->currentToken())) + - string("'") - ); + tokenName = Token::name(m_scanner->currentToken()); + + fatalParserError( + string("Expected assignment operator, got '") + + tokenName + + string("'") + ); } m_scanner->next(); return op; @@ -1467,21 +1466,20 @@ ASTPointer<ASTString> Parser::expectIdentifierToken() Token::Value id = m_scanner->currentToken(); if (id != Token::Identifier) { + string tokenName; if (Token::isElementaryTypeName(id)) //for the sake of accuracy in reporting { ElementaryTypeNameToken elemTypeName = m_scanner->currentElementaryTypeNameToken(); - fatalParserError( - string("Expected identifier, got '") + - elemTypeName.toString() + - string("'") - ); + tokenName = elemTypeName.toString(); } else - fatalParserError( - string("Expected identifier, got '") + - string(Token::name(id)) + - string("'") - ); + tokenName = Token::name(id); + + fatalParserError( + string("Expected identifier, got '") + + tokenName + + string("'") + ); } return getLiteralAndAdvance(); } |