Fixed range violation when an attribute declaration is not finished before EOF
This commit is contained in:
parent
e81f52f949
commit
fbb811fd4d
stdx/d
|
@ -1599,11 +1599,20 @@ class ClassFour(A, B) if (someTest()) : Super {}}c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (currentIs(TokenType.colon))
|
if (currentIs(TokenType.colon))
|
||||||
|
{
|
||||||
node.attributeDeclaration = parseAttributeDeclaration(attr);
|
node.attributeDeclaration = parseAttributeDeclaration(attr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
node.attributes ~= attr;
|
node.attributes ~= attr;
|
||||||
} while (moreTokens());
|
} while (moreTokens());
|
||||||
|
|
||||||
|
if (!moreTokens)
|
||||||
|
{
|
||||||
|
error("Declaration expected");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
with (TokenType) switch (current.type)
|
with (TokenType) switch (current.type)
|
||||||
{
|
{
|
||||||
case semicolon:
|
case semicolon:
|
||||||
|
@ -6247,11 +6256,12 @@ private:
|
||||||
if (suppressMessages <= 0)
|
if (suppressMessages <= 0)
|
||||||
{
|
{
|
||||||
++errorCount;
|
++errorCount;
|
||||||
auto column = index < tokens.length ? tokens[index].column : 0;
|
auto column = index < tokens.length ? tokens[index].column : tokens[$ - 1].column;
|
||||||
column++;
|
auto line = index < tokens.length ? tokens[index].line : tokens[$ - 1].line;
|
||||||
auto line = index < tokens.length ? tokens[index].line : 0;
|
|
||||||
if (messageFunction is null)
|
if (messageFunction is null)
|
||||||
|
{
|
||||||
writefln("%s(%d:%d)[error]: %s", fileName, line, column, message);
|
writefln("%s(%d:%d)[error]: %s", fileName, line, column, message);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
messageFunction(fileName, line, column, message);
|
messageFunction(fileName, line, column, message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue