Fix internal compiler error when parsing `var` declaration without identifier.

This commit is contained in:
Daniel Kirchner
2018-04-12 14:57:14 +02:00
parent c3dc67d0e0
commit 6862f22943
5 changed files with 31 additions and 24 deletions
+4 -2
View File
@@ -607,8 +607,10 @@ ASTPointer<VariableDeclaration> Parser::parseVariableDeclaration(
if (_options.allowEmptyName && m_scanner->currentToken() != Token::Identifier)
{
identifier = make_shared<ASTString>("");
solAssert(type != nullptr, "");
nodeFactory.setEndPositionFromNode(type);
solAssert(!_options.allowVar, ""); // allowEmptyName && allowVar makes no sense
if (type)
nodeFactory.setEndPositionFromNode(type);
// if type is null this has already caused an error
}
else
identifier = expectIdentifierToken();