aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/parsing
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/parsing')
-rw-r--r--libsolidity/parsing/Parser.cpp13
-rw-r--r--libsolidity/parsing/Token.cpp4
2 files changed, 9 insertions, 8 deletions
diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp
index 0bee2a91..c9c26f57 100644
--- a/libsolidity/parsing/Parser.cpp
+++ b/libsolidity/parsing/Parser.cpp
@@ -564,7 +564,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
bool isIndexed = false;
bool isDeclaredConst = false;
Declaration::Visibility visibility(Declaration::Visibility::Default);
- VariableDeclaration::Location location = VariableDeclaration::Location::Default;
+ VariableDeclaration::Location location = VariableDeclaration::Location::Unspecified;
ASTPointer<ASTString> identifier;
while (true)
@@ -572,6 +572,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
Token::Value token = m_scanner->currentToken();
if (_options.isStateVariable && Token::isVariableVisibilitySpecifier(token))
{
+ nodeFactory.markEndPosition();
if (visibility != Declaration::Visibility::Default)
{
parserError(string(
@@ -592,7 +593,7 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
isDeclaredConst = true;
else if (_options.allowLocationSpecifier && Token::isLocationSpecifier(token))
{
- if (location != VariableDeclaration::Location::Default)
+ if (location != VariableDeclaration::Location::Unspecified)
parserError(string("Location already specified."));
else if (!type)
parserError(string("Location specifier needs explicit type name."));
@@ -616,21 +617,21 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
}
else
break;
+ nodeFactory.markEndPosition();
m_scanner->next();
}
}
- nodeFactory.markEndPosition();
if (_options.allowEmptyName && m_scanner->currentToken() != Token::Identifier)
{
identifier = make_shared<ASTString>("");
solAssert(!_options.allowVar, ""); // allowEmptyName && allowVar makes no sense
- if (type)
- nodeFactory.setEndPositionFromNode(type);
- // if type is null this has already caused an error
}
else
+ {
+ nodeFactory.markEndPosition();
identifier = expectIdentifierToken();
+ }
ASTPointer<Expression> value;
if (_options.allowInitialValue)
{
diff --git a/libsolidity/parsing/Token.cpp b/libsolidity/parsing/Token.cpp
index 5ce74316..27acb7d4 100644
--- a/libsolidity/parsing/Token.cpp
+++ b/libsolidity/parsing/Token.cpp
@@ -63,7 +63,7 @@ void ElementaryTypeNameToken::assertDetails(Token::Value _baseType, unsigned con
{
solAssert(_second == 0, "There should not be a second size argument to type " + string(Token::toString(_baseType)) + ".");
solAssert(
- _first <= 256 && _first % 8 == 0,
+ _first <= 256 && _first % 8 == 0,
"No elementary type " + string(Token::toString(_baseType)) + to_string(_first) + "."
);
}
@@ -165,7 +165,7 @@ tuple<Token::Value, unsigned int, unsigned int> Token::fromIdentifierOrKeyword(s
else
return make_tuple(Token::FixedMxN, m, n);
}
- }
+ }
}
return make_tuple(Token::Identifier, 0, 0);
}