Skip to content

Commit 62a568d

Browse files
committed
Update baselines and skip @public/etc when parsing
1. Update the API baselines with the new functions. 2. Do not check for @public/etc during parsing, because parent pointers aren't set, so non-local tags will be missed; this wrong answer will then be cached.
1 parent b80847b commit 62a568d

File tree

3 files changed

+83
-39
lines changed

3 files changed

+83
-39
lines changed

src/compiler/utilities.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4130,7 +4130,9 @@ namespace ts {
41304130

41314131
export function getEffectiveModifierFlags(node: Node) {
41324132
const flags = getModifierFlags(node);
4133-
if (isInJSFile(node)) {
4133+
if (!!node.parent && isInJSFile(node)) {
4134+
// Do not try to look for tags during parsing, because parent pointers aren't set and
4135+
// non-local tags will incorrectly be missed; this wrong answer will be cached.
41344136
const tags = (getJSDocPublicTag(node) ? ModifierFlags.Public : ModifierFlags.None)
41354137
| (getJSDocPrivateTag(node) ? ModifierFlags.Private : ModifierFlags.None)
41364138
| (getJSDocProtectedTag(node) ? ModifierFlags.Protected : ModifierFlags.None);

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -383,23 +383,26 @@ declare namespace ts {
383383
JSDocAugmentsTag = 305,
384384
JSDocAuthorTag = 306,
385385
JSDocClassTag = 307,
386-
JSDocCallbackTag = 308,
387-
JSDocEnumTag = 309,
388-
JSDocParameterTag = 310,
389-
JSDocReturnTag = 311,
390-
JSDocThisTag = 312,
391-
JSDocTypeTag = 313,
392-
JSDocTemplateTag = 314,
393-
JSDocTypedefTag = 315,
394-
JSDocPropertyTag = 316,
395-
SyntaxList = 317,
396-
NotEmittedStatement = 318,
397-
PartiallyEmittedExpression = 319,
398-
CommaListExpression = 320,
399-
MergeDeclarationMarker = 321,
400-
EndOfDeclarationMarker = 322,
401-
SyntheticReferenceExpression = 323,
402-
Count = 324,
386+
JSDocPublicTag = 308,
387+
JSDocPrivateTag = 309,
388+
JSDocProtectedTag = 310,
389+
JSDocCallbackTag = 311,
390+
JSDocEnumTag = 312,
391+
JSDocParameterTag = 313,
392+
JSDocReturnTag = 314,
393+
JSDocThisTag = 315,
394+
JSDocTypeTag = 316,
395+
JSDocTemplateTag = 317,
396+
JSDocTypedefTag = 318,
397+
JSDocPropertyTag = 319,
398+
SyntaxList = 320,
399+
NotEmittedStatement = 321,
400+
PartiallyEmittedExpression = 322,
401+
CommaListExpression = 323,
402+
MergeDeclarationMarker = 324,
403+
EndOfDeclarationMarker = 325,
404+
SyntheticReferenceExpression = 326,
405+
Count = 327,
403406
FirstAssignment = 62,
404407
LastAssignment = 74,
405408
FirstCompoundAssignment = 63,
@@ -428,9 +431,9 @@ declare namespace ts {
428431
LastStatement = 240,
429432
FirstNode = 152,
430433
FirstJSDocNode = 292,
431-
LastJSDocNode = 316,
434+
LastJSDocNode = 319,
432435
FirstJSDocTagNode = 304,
433-
LastJSDocTagNode = 316,
436+
LastJSDocTagNode = 319,
434437
}
435438
export enum NodeFlags {
436439
None = 0,
@@ -1619,6 +1622,15 @@ declare namespace ts {
16191622
export interface JSDocClassTag extends JSDocTag {
16201623
kind: SyntaxKind.JSDocClassTag;
16211624
}
1625+
export interface JSDocPublicTag extends JSDocTag {
1626+
kind: SyntaxKind.JSDocPublicTag;
1627+
}
1628+
export interface JSDocPrivateTag extends JSDocTag {
1629+
kind: SyntaxKind.JSDocPrivateTag;
1630+
}
1631+
export interface JSDocProtectedTag extends JSDocTag {
1632+
kind: SyntaxKind.JSDocProtectedTag;
1633+
}
16221634
export interface JSDocEnumTag extends JSDocTag, Declaration {
16231635
parent: JSDoc;
16241636
kind: SyntaxKind.JSDocEnumTag;
@@ -3426,6 +3438,12 @@ declare namespace ts {
34263438
function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag | undefined;
34273439
/** Gets the JSDoc class tag for the node if present */
34283440
function getJSDocClassTag(node: Node): JSDocClassTag | undefined;
3441+
/** Gets the JSDoc public tag for the node if present */
3442+
function getJSDocPublicTag(node: Node): JSDocPublicTag | undefined;
3443+
/** Gets the JSDoc private tag for the node if present */
3444+
function getJSDocPrivateTag(node: Node): JSDocPrivateTag | undefined;
3445+
/** Gets the JSDoc protected tag for the node if present */
3446+
function getJSDocProtectedTag(node: Node): JSDocProtectedTag | undefined;
34293447
/** Gets the JSDoc enum tag for the node if present */
34303448
function getJSDocEnumTag(node: Node): JSDocEnumTag | undefined;
34313449
/** Gets the JSDoc this tag for the node if present */
@@ -3630,6 +3648,9 @@ declare namespace ts {
36303648
function isJSDocAuthorTag(node: Node): node is JSDocAuthorTag;
36313649
function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
36323650
function isJSDocClassTag(node: Node): node is JSDocClassTag;
3651+
function isJSDocPublicTag(node: Node): node is JSDocPublicTag;
3652+
function isJSDocPrivateTag(node: Node): node is JSDocPrivateTag;
3653+
function isJSDocProtectedTag(node: Node): node is JSDocProtectedTag;
36333654
function isJSDocEnumTag(node: Node): node is JSDocEnumTag;
36343655
function isJSDocThisTag(node: Node): node is JSDocThisTag;
36353656
function isJSDocParameterTag(node: Node): node is JSDocParameterTag;

tests/baselines/reference/api/typescript.d.ts

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -383,23 +383,26 @@ declare namespace ts {
383383
JSDocAugmentsTag = 305,
384384
JSDocAuthorTag = 306,
385385
JSDocClassTag = 307,
386-
JSDocCallbackTag = 308,
387-
JSDocEnumTag = 309,
388-
JSDocParameterTag = 310,
389-
JSDocReturnTag = 311,
390-
JSDocThisTag = 312,
391-
JSDocTypeTag = 313,
392-
JSDocTemplateTag = 314,
393-
JSDocTypedefTag = 315,
394-
JSDocPropertyTag = 316,
395-
SyntaxList = 317,
396-
NotEmittedStatement = 318,
397-
PartiallyEmittedExpression = 319,
398-
CommaListExpression = 320,
399-
MergeDeclarationMarker = 321,
400-
EndOfDeclarationMarker = 322,
401-
SyntheticReferenceExpression = 323,
402-
Count = 324,
386+
JSDocPublicTag = 308,
387+
JSDocPrivateTag = 309,
388+
JSDocProtectedTag = 310,
389+
JSDocCallbackTag = 311,
390+
JSDocEnumTag = 312,
391+
JSDocParameterTag = 313,
392+
JSDocReturnTag = 314,
393+
JSDocThisTag = 315,
394+
JSDocTypeTag = 316,
395+
JSDocTemplateTag = 317,
396+
JSDocTypedefTag = 318,
397+
JSDocPropertyTag = 319,
398+
SyntaxList = 320,
399+
NotEmittedStatement = 321,
400+
PartiallyEmittedExpression = 322,
401+
CommaListExpression = 323,
402+
MergeDeclarationMarker = 324,
403+
EndOfDeclarationMarker = 325,
404+
SyntheticReferenceExpression = 326,
405+
Count = 327,
403406
FirstAssignment = 62,
404407
LastAssignment = 74,
405408
FirstCompoundAssignment = 63,
@@ -428,9 +431,9 @@ declare namespace ts {
428431
LastStatement = 240,
429432
FirstNode = 152,
430433
FirstJSDocNode = 292,
431-
LastJSDocNode = 316,
434+
LastJSDocNode = 319,
432435
FirstJSDocTagNode = 304,
433-
LastJSDocTagNode = 316,
436+
LastJSDocTagNode = 319,
434437
}
435438
export enum NodeFlags {
436439
None = 0,
@@ -1619,6 +1622,15 @@ declare namespace ts {
16191622
export interface JSDocClassTag extends JSDocTag {
16201623
kind: SyntaxKind.JSDocClassTag;
16211624
}
1625+
export interface JSDocPublicTag extends JSDocTag {
1626+
kind: SyntaxKind.JSDocPublicTag;
1627+
}
1628+
export interface JSDocPrivateTag extends JSDocTag {
1629+
kind: SyntaxKind.JSDocPrivateTag;
1630+
}
1631+
export interface JSDocProtectedTag extends JSDocTag {
1632+
kind: SyntaxKind.JSDocProtectedTag;
1633+
}
16221634
export interface JSDocEnumTag extends JSDocTag, Declaration {
16231635
parent: JSDoc;
16241636
kind: SyntaxKind.JSDocEnumTag;
@@ -3426,6 +3438,12 @@ declare namespace ts {
34263438
function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag | undefined;
34273439
/** Gets the JSDoc class tag for the node if present */
34283440
function getJSDocClassTag(node: Node): JSDocClassTag | undefined;
3441+
/** Gets the JSDoc public tag for the node if present */
3442+
function getJSDocPublicTag(node: Node): JSDocPublicTag | undefined;
3443+
/** Gets the JSDoc private tag for the node if present */
3444+
function getJSDocPrivateTag(node: Node): JSDocPrivateTag | undefined;
3445+
/** Gets the JSDoc protected tag for the node if present */
3446+
function getJSDocProtectedTag(node: Node): JSDocProtectedTag | undefined;
34293447
/** Gets the JSDoc enum tag for the node if present */
34303448
function getJSDocEnumTag(node: Node): JSDocEnumTag | undefined;
34313449
/** Gets the JSDoc this tag for the node if present */
@@ -3630,6 +3648,9 @@ declare namespace ts {
36303648
function isJSDocAuthorTag(node: Node): node is JSDocAuthorTag;
36313649
function isJSDocAugmentsTag(node: Node): node is JSDocAugmentsTag;
36323650
function isJSDocClassTag(node: Node): node is JSDocClassTag;
3651+
function isJSDocPublicTag(node: Node): node is JSDocPublicTag;
3652+
function isJSDocPrivateTag(node: Node): node is JSDocPrivateTag;
3653+
function isJSDocProtectedTag(node: Node): node is JSDocProtectedTag;
36333654
function isJSDocEnumTag(node: Node): node is JSDocEnumTag;
36343655
function isJSDocThisTag(node: Node): node is JSDocThisTag;
36353656
function isJSDocParameterTag(node: Node): node is JSDocParameterTag;

0 commit comments

Comments
 (0)