|
@ -268,17 +268,28 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(VarDeclParserOp |
|
|
ASTNodeFactory nodeFactory(*this); |
|
|
ASTNodeFactory nodeFactory(*this); |
|
|
ASTPointer<TypeName> type = parseTypeName(_options.allowVar); |
|
|
ASTPointer<TypeName> type = parseTypeName(_options.allowVar); |
|
|
bool isIndexed = false; |
|
|
bool isIndexed = false; |
|
|
|
|
|
ASTPointer<ASTString> identifier; |
|
|
Token::Value token = m_scanner->getCurrentToken(); |
|
|
Token::Value token = m_scanner->getCurrentToken(); |
|
|
|
|
|
Declaration::Visibility visibility(Declaration::Visibility::DEFAULT); |
|
|
|
|
|
if (_options.isStateVariable && Token::isVisibilitySpecifier(token)) |
|
|
|
|
|
visibility = parseVisibilitySpecifier(token); |
|
|
if (_options.allowIndexed && token == Token::INDEXED) |
|
|
if (_options.allowIndexed && token == Token::INDEXED) |
|
|
{ |
|
|
{ |
|
|
isIndexed = true; |
|
|
isIndexed = true; |
|
|
m_scanner->next(); |
|
|
m_scanner->next(); |
|
|
} |
|
|
} |
|
|
Declaration::Visibility visibility(Declaration::Visibility::DEFAULT); |
|
|
if (_options.allowEmptyName && m_scanner->getCurrentToken() != Token::IDENTIFIER) |
|
|
if (_options.isStateVariable && Token::isVisibilitySpecifier(token)) |
|
|
{ |
|
|
visibility = parseVisibilitySpecifier(token); |
|
|
identifier = make_shared<ASTString>(""); |
|
|
|
|
|
nodeFactory.setEndPositionFromNode(type); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
nodeFactory.markEndPosition(); |
|
|
|
|
|
identifier = expectIdentifierToken(); |
|
|
|
|
|
} |
|
|
nodeFactory.markEndPosition(); |
|
|
nodeFactory.markEndPosition(); |
|
|
return nodeFactory.createNode<VariableDeclaration>(type, expectIdentifierToken(), |
|
|
return nodeFactory.createNode<VariableDeclaration>(type, identifier, |
|
|
visibility, _options.isStateVariable, |
|
|
visibility, _options.isStateVariable, |
|
|
isIndexed); |
|
|
isIndexed); |
|
|
} |
|
|
} |
|
@ -402,6 +413,7 @@ ASTPointer<ParameterList> Parser::parseParameterList(bool _allowEmpty, bool _all |
|
|
vector<ASTPointer<VariableDeclaration>> parameters; |
|
|
vector<ASTPointer<VariableDeclaration>> parameters; |
|
|
VarDeclParserOptions options; |
|
|
VarDeclParserOptions options; |
|
|
options.allowIndexed = _allowIndexed; |
|
|
options.allowIndexed = _allowIndexed; |
|
|
|
|
|
options.allowEmptyName = true; |
|
|
expectToken(Token::LPAREN); |
|
|
expectToken(Token::LPAREN); |
|
|
if (!_allowEmpty || m_scanner->getCurrentToken() != Token::RPAREN) |
|
|
if (!_allowEmpty || m_scanner->getCurrentToken() != Token::RPAREN) |
|
|
{ |
|
|
{ |
|
|