Fix triple-slash reference classification

This commit is contained in:
Nathan Shively-Sanders 2020-08-06 10:53:08 -07:00
parent ae4b29c559
commit a835635a18
2 changed files with 2 additions and 2 deletions

View File

@ -7215,6 +7215,7 @@ namespace ts {
}
function parseJSDocCommentWorker(startOrRanges: number | CommentRange[] = 0, length: number | undefined): JSDoc | undefined {
// const isTripleSlash = Array.isArray(startOrRanges);
// TODO: Probably should save a boolean isTripleSlash at the beginning and make all the nested functions change their behaviour.
const content = sourceText; // TODO: Why alias this?
const comments: string[] = [];
@ -7226,7 +7227,6 @@ namespace ts {
const ranges = startOrRanges;
let currentTag: JSDocTag | undefined; // TODO: Probably can use tags
for (const { pos: start, end } of ranges) {
if (isRecognizedTripleSlashComment(content, start, end)) continue;
const length = end - start;
scanner.scanRange(start + 3, length - 3, () => {
while (nextTokenJSDoc() !== SyntaxKind.EndOfFileToken) {

View File

@ -1111,7 +1111,7 @@ namespace ts {
text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk &&
text.charCodeAt(comment.pos + 2) === CharacterCodes.asterisk &&
text.charCodeAt(comment.pos + 3) !== CharacterCodes.slash
|| isTripleSlashComment(comment, text));
|| isTripleSlashComment(comment, text) && !isRecognizedTripleSlashComment(text, comment.pos, comment.end));
}
export const fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;