Fix scanner offset and make it easier to read

This commit is contained in:
Nathan Shively-Sanders
2020-08-05 16:17:56 -07:00
parent 70f057339d
commit cf63bce7af
4 changed files with 89 additions and 4 deletions
+3 -3
View File
@@ -1745,10 +1745,10 @@ namespace ts {
case CharacterCodes.slash:
// Single-line comment
if (text.charCodeAt(pos + 1) === CharacterCodes.slash) {
pos += 2;
if (text.charCodeAt(pos + 2) === CharacterCodes.slash) {
tokenFlags |= TokenFlags.PrecedingJSDocComment;
}
pos += 2;
while (pos < end) {
if (isLineBreak(text.charCodeAt(pos))) {
@@ -1773,10 +1773,10 @@ namespace ts {
}
// Multi-line comment
if (text.charCodeAt(pos + 1) === CharacterCodes.asterisk) {
pos += 2;
if (text.charCodeAt(pos) === CharacterCodes.asterisk && text.charCodeAt(pos + 1) !== CharacterCodes.slash) {
if (text.charCodeAt(pos + 2) === CharacterCodes.asterisk && text.charCodeAt(pos + 3) !== CharacterCodes.slash) {
tokenFlags |= TokenFlags.PrecedingJSDocComment;
}
pos += 2;
let commentClosed = false;
let lastLineStart = tokenPos;