aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/Parser.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-10-10 02:44:56 +0800
committerchriseth <c@ethdev.com>2015-10-13 18:16:23 +0800
commitdeebc7e8601185006b74a5ee78b83c50bdf37abc (patch)
treefcd4f68acc0ca65e10e16eba170bc89180ea9468 /libsolidity/Parser.cpp
parenta5d12b876180088904a026c472da23201a35d59c (diff)
downloaddexon-solidity-deebc7e8601185006b74a5ee78b83c50bdf37abc.tar.gz
dexon-solidity-deebc7e8601185006b74a5ee78b83c50bdf37abc.tar.zst
dexon-solidity-deebc7e8601185006b74a5ee78b83c50bdf37abc.zip
Multi-variable declarations.
Diffstat (limited to 'libsolidity/Parser.cpp')
-rw-r--r--libsolidity/Parser.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/libsolidity/Parser.cpp b/libsolidity/Parser.cpp
index e02a70d5..98e1fbf8 100644
--- a/libsolidity/Parser.cpp
+++ b/libsolidity/Parser.cpp
@@ -785,12 +785,13 @@ ASTPointer<VariableDeclarationStatement> Parser::parseVariableDeclarationStateme
// Parse `var (a, b, ,, c) = ...` into a single VariableDeclarationStatement with multiple variables.
m_scanner->next();
m_scanner->next();
- do
+ while (true)
{
ASTPointer<VariableDeclaration> var;
- if (m_scanner->currentToken() == Token::Comma)
- m_scanner->next();
- else
+ if (
+ m_scanner->currentToken() != Token::Comma &&
+ m_scanner->currentToken() != Token::RParen
+ )
{
ASTNodeFactory varDeclNodeFactory(*this);
ASTPointer<ASTString> name = expectIdentifierToken();
@@ -802,7 +803,11 @@ ASTPointer<VariableDeclarationStatement> Parser::parseVariableDeclarationStateme
);
}
variables.push_back(var);
- } while (m_scanner->currentToken() != Token::RParen);
+ if (m_scanner->currentToken() == Token::RParen)
+ break;
+ else
+ expectToken(Token::Comma);
+ }
nodeFactory.markEndPosition();
m_scanner->next();
}