@ -135,7 +135,6 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition()
}
while ( m_scanner - > getCurrentToken ( ) = = Token : : Comma ) ;
expectToken ( Token : : LBrace ) ;
bool isDeclaredConst = false ;
while ( true )
{
Token : : Value currentToken = m_scanner - > getCurrentToken ( ) ;
@ -153,21 +152,13 @@ ASTPointer<ContractDefinition> Parser::parseContractDefinition()
VarDeclParserOptions options ;
options . isStateVariable = true ;
options . allowInitialValue = true ;
options . isDeclaredConst = isDeclaredConst ;
stateVariables . push_back ( parseVariableDeclaration ( options ) ) ;
isDeclaredConst = false ;
expectToken ( Token : : Semicolon ) ;
}
else if ( currentToken = = Token : : Modifier )
modifiers . push_back ( parseModifierDefinition ( ) ) ;
else if ( currentToken = = Token : : Event )
events . push_back ( parseEventDefinition ( ) ) ;
else if ( currentToken = = Token : : Const )
{
solAssert ( Token : : isElementaryTypeName ( m_scanner - > peekNextToken ( ) ) , " " ) ;
isDeclaredConst = true ;
m_scanner - > next ( ) ;
}
else
BOOST_THROW_EXCEPTION ( createParserError ( " Function, variable, struct or modifier declaration expected. " ) ) ;
}
@ -326,6 +317,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
nodeFactory . setEndPositionFromNode ( type ) ;
}
bool isIndexed = false ;
bool isDeclaredConst = false ;
ASTPointer < ASTString > identifier ;
Token : : Value token = m_scanner - > getCurrentToken ( ) ;
Declaration : : Visibility visibility ( Declaration : : Visibility : : Default ) ;
@ -336,7 +328,13 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
isIndexed = true ;
m_scanner - > next ( ) ;
}
if ( token = = Token : : Const )
{
m_scanner - > next ( ) ;
isDeclaredConst = true ;
}
nodeFactory . markEndPosition ( ) ;
if ( _options . allowEmptyName & & m_scanner - > getCurrentToken ( ) ! = Token : : Identifier )
{
identifier = make_shared < ASTString > ( " " ) ;
@ -357,7 +355,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
}
return nodeFactory . createNode < VariableDeclaration > ( type , identifier , value ,
visibility , _options . isStateVariable ,
isIndexed , _options . isDeclaredConst ) ;
isIndexed , isDeclaredConst ) ;
}
ASTPointer < ModifierDefinition > Parser : : parseModifierDefinition ( )