parseJSDocCommentWorker: Don't need result (#25197)

This commit is contained in:
Andy
2018-06-25 11:34:20 -07:00
committed by GitHub
parent 8923a01481
commit 62e5541a66

View File

@@ -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();