fix end-of-file assert failure

This commit is contained in:
Arthur Ozga 2017-08-10 10:01:42 -07:00
parent 7c402d509d
commit de92e98770

View File

@ -107,12 +107,14 @@ namespace ts {
scanner.setTextPos(pos);
while (pos < end) {
const token = scanner.scan();
Debug.assert(token !== SyntaxKind.EndOfFileToken); // Else it would infinitely loop
const textPos = scanner.getTextPos();
if (textPos <= end) {
nodes.push(createNode(token, pos, textPos, this));
}
pos = textPos;
if (token === SyntaxKind.EndOfFileToken) {
return pos;
}
}
return pos;
}