Skip to content

Commit c6a2e45

Browse files
authored
Add @deprecated to tree walk (microsoft#43473)
So various things don't crash. Fixes microsoft#43472
1 parent 8f8a579 commit c6a2e45

3 files changed

Lines changed: 127 additions & 0 deletions

File tree

src/compiler/parser.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ namespace ts {
551551
case SyntaxKind.JSDocPrivateTag:
552552
case SyntaxKind.JSDocProtectedTag:
553553
case SyntaxKind.JSDocReadonlyTag:
554+
case SyntaxKind.JSDocDeprecatedTag:
554555
return visitNode(cbNode, (node as JSDocTag).tagName)
555556
|| (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray<JSDocText | JSDocLink> | undefined));
556557
case SyntaxKind.PartiallyEmittedExpression:
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
[
2+
{
3+
"marker": {
4+
"fileName": "/tests/cases/fourslash/quickInfoInheritedLinkTag.ts",
5+
"position": 258,
6+
"name": ""
7+
},
8+
"quickInfo": {
9+
"kind": "method",
10+
"kindModifiers": "deprecated",
11+
"textSpan": {
12+
"start": 257,
13+
"length": 1
14+
},
15+
"displayParts": [
16+
{
17+
"text": "(",
18+
"kind": "punctuation"
19+
},
20+
{
21+
"text": "method",
22+
"kind": "text"
23+
},
24+
{
25+
"text": ")",
26+
"kind": "punctuation"
27+
},
28+
{
29+
"text": " ",
30+
"kind": "space"
31+
},
32+
{
33+
"text": "C",
34+
"kind": "className"
35+
},
36+
{
37+
"text": ".",
38+
"kind": "punctuation"
39+
},
40+
{
41+
"text": "m",
42+
"kind": "methodName"
43+
},
44+
{
45+
"text": "(",
46+
"kind": "punctuation"
47+
},
48+
{
49+
"text": ")",
50+
"kind": "punctuation"
51+
},
52+
{
53+
"text": ":",
54+
"kind": "punctuation"
55+
},
56+
{
57+
"text": " ",
58+
"kind": "space"
59+
},
60+
{
61+
"text": "void",
62+
"kind": "keyword"
63+
}
64+
],
65+
"documentation": [],
66+
"tags": [
67+
{
68+
"name": "deprecated",
69+
"text": [
70+
{
71+
"text": "Use ",
72+
"kind": "text"
73+
},
74+
{
75+
"text": "{@link ",
76+
"kind": "link"
77+
},
78+
{
79+
"text": "PerspectiveCamera#setFocalLength .setFocalLength()",
80+
"kind": "linkText"
81+
},
82+
{
83+
"text": "}",
84+
"kind": "link"
85+
},
86+
{
87+
"text": " and ",
88+
"kind": "text"
89+
},
90+
{
91+
"text": "{@link ",
92+
"kind": "link"
93+
},
94+
{
95+
"text": "PerspectiveCamera#filmGauge .filmGauge",
96+
"kind": "linkText"
97+
},
98+
{
99+
"text": "}",
100+
"kind": "link"
101+
},
102+
{
103+
"text": " instead.",
104+
"kind": "text"
105+
}
106+
]
107+
}
108+
]
109+
}
110+
}
111+
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// export class C {
4+
//// /**
5+
//// * @deprecated Use {@link PerspectiveCamera#setFocalLength .setFocalLength()} and {@link PerspectiveCamera#filmGauge .filmGauge} instead.
6+
//// */
7+
//// m() { }
8+
//// }
9+
//// export class D extends C {
10+
//// m() { } // crashes here
11+
//// }
12+
//// new C().m/**/ // and here (with a different thing trying to access undefined)
13+
14+
verify.noErrors()
15+
verify.baselineQuickInfo();

0 commit comments

Comments
 (0)