mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Skip triple-slash references
This commit is contained in:
+14
-4
@@ -7215,6 +7215,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseJSDocCommentWorker(startOrRanges: number | CommentRange[] = 0, length: number | undefined): JSDoc | undefined {
|
||||
// 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[] = [];
|
||||
let tags: JSDocTag[];
|
||||
@@ -7223,16 +7224,25 @@ namespace ts {
|
||||
if (Array.isArray(startOrRanges)) {
|
||||
if (!startOrRanges.length) return undefined;
|
||||
const ranges = startOrRanges;
|
||||
for (const comment of ranges) {
|
||||
const { pos: start, end } = comment;
|
||||
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) {
|
||||
if (token() === SyntaxKind.AtToken) {
|
||||
addTag(parseTag(0));
|
||||
addTag(currentTag);
|
||||
currentTag = parseTag(0);
|
||||
}
|
||||
else {
|
||||
comments.push(scanner.getTokenText());
|
||||
if (currentTag) {
|
||||
// this doesn't update currentTag.end, which will cause problems later
|
||||
// I think that parseXTag will have to return unfinished tags or something.
|
||||
(currentTag as any).comment = (currentTag.comment || "") + scanner.getTokenText()
|
||||
}
|
||||
else {
|
||||
comments.push(scanner.getTokenText());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user