mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-11 06:02:53 -05:00
parseJSDocCommentWorker: Don't need result (#25197)
This commit is contained in:
@@ -6334,19 +6334,18 @@ namespace ts {
|
||||
Debug.assert(start <= end);
|
||||
Debug.assert(end <= content.length);
|
||||
|
||||
// Check for /** (JSDoc opening part)
|
||||
if (!isJSDocLikeText(content, start)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let tags: JSDocTag[];
|
||||
let tagsPos: number;
|
||||
let tagsEnd: number;
|
||||
const comments: string[] = [];
|
||||
let result: JSDoc | undefined;
|
||||
|
||||
// Check for /** (JSDoc opening part)
|
||||
if (!isJSDocLikeText(content, start)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// + 3 for leading /**, - 5 in total for /** */
|
||||
scanner.scanRange(start + 3, length - 5, () => {
|
||||
return scanner.scanRange(start + 3, length - 5, () => {
|
||||
// Initially we can parse out a tag. We also have seen a starting asterisk.
|
||||
// This is so that /** * @type */ doesn't parse.
|
||||
let state = JSDocState.SawAsterisk;
|
||||
@@ -6432,11 +6431,9 @@ namespace ts {
|
||||
}
|
||||
removeLeadingNewlines(comments);
|
||||
removeTrailingNewlines(comments);
|
||||
result = createJSDocComment();
|
||||
return createJSDocComment();
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
function removeLeadingNewlines(comments: string[]) {
|
||||
while (comments.length && (comments[0] === "\n" || comments[0] === "\r")) {
|
||||
comments.shift();
|
||||
|
||||
Reference in New Issue
Block a user