Skip to content

Commit 91e6bce

Browse files
committed
Address PR comments
1 parent 7caee79 commit 91e6bce

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

src/compiler/binder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,8 @@ namespace ts {
599599
// Binding of JsDocComment should be done before the current block scope container changes.
600600
// because the scope of JsDocComment should not be affected by whether the current node is a
601601
// container or not.
602-
if (isInJavaScriptFile(node) && node.jsDocComments) {
603-
forEach(node.jsDocComments, bind);
602+
if (isInJavaScriptFile(node) && node.jsDoc) {
603+
forEach(node.jsDoc, bind);
604604
}
605605
if (checkUnreachable(node)) {
606606
bindEachChild(node);

src/compiler/parser.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,10 @@ namespace ts {
689689
continue;
690690
}
691691

692-
if (!node.jsDocComments) {
693-
node.jsDocComments = [];
692+
if (!node.jsDoc) {
693+
node.jsDoc = [];
694694
}
695-
node.jsDocComments.push(jsDoc);
695+
node.jsDoc.push(jsDoc);
696696
}
697697
}
698698

@@ -719,11 +719,11 @@ namespace ts {
719719
const saveParent = parent;
720720
parent = n;
721721
forEachChild(n, visitNode);
722-
if (n.jsDocComments) {
723-
for (const jsDocComment of n.jsDocComments) {
724-
jsDocComment.parent = n;
725-
parent = jsDocComment;
726-
forEachChild(jsDocComment, visitNode);
722+
if (n.jsDoc) {
723+
for (const jsDoc of n.jsDoc) {
724+
jsDoc.parent = n;
725+
parent = jsDoc;
726+
forEachChild(jsDoc, visitNode);
727727
}
728728
}
729729
parent = saveParent;
@@ -6954,8 +6954,8 @@ namespace ts {
69546954
}
69556955

69566956
forEachChild(node, visitNode, visitArray);
6957-
if (node.jsDocComments) {
6958-
for (const jsDocComment of node.jsDocComments) {
6957+
if (node.jsDoc) {
6958+
for (const jsDocComment of node.jsDoc) {
69596959
forEachChild(jsDocComment, visitNode, visitArray);
69606960
}
69616961
}

src/compiler/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ namespace ts {
497497
parent?: Node; // Parent node (initialized by binding)
498498
/* @internal */ original?: Node; // The original node if this is an updated node.
499499
/* @internal */ startsOnNewLine?: boolean; // Whether a synthesized node should start on a new line (used by transforms).
500-
/* @internal */ jsDocComments?: JSDoc[]; // JSDoc for the node, if it has any.
501-
/* @internal */ jsDocCache?: (JSDoc | JSDocTag)[]; // JSDoc for the node, plus JSDoc and tags retrieved from its parents
500+
/* @internal */ jsDoc?: JSDoc[]; // JSDoc that directly precedes this node
501+
/* @internal */ jsDocCache?: (JSDoc | JSDocTag)[]; // All JSDoc that applies to the node, including parent docs and @param tags
502502
/* @internal */ symbol?: Symbol; // Symbol declared by node (initialized by binding)
503503
/* @internal */ locals?: SymbolTable; // Locals associated with node (initialized by binding)
504504
/* @internal */ nextContainer?: Node; // Next container in declaration order (initialized by binding)

src/compiler/utilities.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ namespace ts {
239239
return !nodeIsMissing(node);
240240
}
241241

242-
export function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDocComment?: boolean): number {
242+
export function getTokenPosOfNode(node: Node, sourceFile?: SourceFile, includeJsDoc?: boolean): number {
243243
// With nodes that have no width (i.e. 'Missing' nodes), we actually *don't*
244244
// want to skip trivia because this will launch us forward to the next token.
245245
if (nodeIsMissing(node)) {
@@ -250,16 +250,16 @@ namespace ts {
250250
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);
251251
}
252252

253-
if (includeJsDocComment && node.jsDocComments && node.jsDocComments.length > 0) {
254-
return getTokenPosOfNode(node.jsDocComments[0]);
253+
if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) {
254+
return getTokenPosOfNode(node.jsDoc[0]);
255255
}
256256

257257
// For a syntax list, it is possible that one of its children has JSDocComment nodes, while
258258
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
259259
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
260260
// first child to determine the actual position of its first token.
261261
if (node.kind === SyntaxKind.SyntaxList && (<SyntaxList>node)._children.length > 0) {
262-
return getTokenPosOfNode((<SyntaxList>node)._children[0], sourceFile, includeJsDocComment);
262+
return getTokenPosOfNode((<SyntaxList>node)._children[0], sourceFile, includeJsDoc);
263263
}
264264

265265
return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -1495,10 +1495,10 @@ namespace ts {
14951495
}
14961496

14971497
if (isVariableLike(node) && node.initializer) {
1498-
cache = concatenate(cache, node.initializer.jsDocComments);
1498+
cache = concatenate(cache, node.initializer.jsDoc);
14991499
}
15001500

1501-
cache = concatenate(cache, node.jsDocComments);
1501+
cache = concatenate(cache, node.jsDoc);
15021502
}
15031503
}
15041504

src/services/navigationBar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ namespace ts.NavigationBar {
225225
break;
226226

227227
default:
228-
forEach(node.jsDocComments, jsDocComment => {
229-
forEach(jsDocComment.tags, tag => {
228+
forEach(node.jsDoc, jsDoc => {
229+
forEach(jsDoc.tags, tag => {
230230
if (tag.kind === SyntaxKind.JSDocTypedefTag) {
231231
addLeafNode(tag);
232232
}

src/services/services.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,9 +1956,9 @@ namespace ts {
19561956
break;
19571957
default:
19581958
forEachChild(node, walk);
1959-
if (node.jsDocComments) {
1960-
for (const jsDocComment of node.jsDocComments) {
1961-
forEachChild(jsDocComment, walk);
1959+
if (node.jsDoc) {
1960+
for (const jsDoc of node.jsDoc) {
1961+
forEachChild(jsDoc, walk);
19621962
}
19631963
}
19641964
}

src/services/utilities.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -951,10 +951,10 @@ namespace ts {
951951
}
952952

953953
if (node) {
954-
if (node.jsDocComments) {
955-
for (const jsDocComment of node.jsDocComments) {
956-
if (jsDocComment.tags) {
957-
for (const tag of jsDocComment.tags) {
954+
if (node.jsDoc) {
955+
for (const jsDoc of node.jsDoc) {
956+
if (jsDoc.tags) {
957+
for (const tag of jsDoc.tags) {
958958
if (tag.pos <= position && position <= tag.end) {
959959
return tag;
960960
}

0 commit comments

Comments
 (0)