mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Parsing of immutable state variable.
This commit is contained in:
@@ -730,8 +730,18 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
|
||||
{
|
||||
if (_options.allowIndexed && token == Token::Indexed)
|
||||
isIndexed = true;
|
||||
else if (token == Token::Constant)
|
||||
constantness = VariableDeclaration::Constantness::Constant;
|
||||
else if (token == Token::Constant || token == Token::Immutable)
|
||||
{
|
||||
if (constantness != VariableDeclaration::Constantness::Mutable)
|
||||
parserError(
|
||||
string("Constantness already set to ") +
|
||||
(constantness == VariableDeclaration::Constantness::Constant ? "\"constant\"" : "\"immutable\"")
|
||||
);
|
||||
else if (token == Token::Constant)
|
||||
constantness = VariableDeclaration::Constantness::Constant;
|
||||
else if (token == Token::Immutable)
|
||||
constantness = VariableDeclaration::Constantness::Immutable;
|
||||
}
|
||||
else if (_options.allowLocationSpecifier && TokenTraits::isLocationSpecifier(token))
|
||||
{
|
||||
if (location != VariableDeclaration::Location::Unspecified)
|
||||
|
||||
Reference in New Issue
Block a user