Skip to content

Commit f775dec

Browse files
author
Andy Hanson
committed
Simplify addJSDocComment
1 parent 806a661 commit f775dec

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/compiler/parser.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -864,13 +864,8 @@ namespace ts {
864864
}
865865

866866
function addJSDocComment<T extends HasJSDoc>(node: T): T {
867-
const comments = getJSDocCommentRanges(node, sourceFile.text);
868-
if (comments) {
869-
for (const comment of comments) {
870-
node.jsDoc = append<JSDoc>(node.jsDoc, JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
871-
}
872-
}
873-
867+
const jsDoc = mapDefined(getJSDocCommentRanges(node, sourceFile.text), comment => JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos));
868+
if (jsDoc) node.jsDoc = jsDoc;
874869
return node;
875870
}
876871

0 commit comments

Comments
 (0)