Add @deprecated to tree walk (#43473)

So various things don't crash. Fixes #43472
This commit is contained in:
Nathan Shively-Sanders 2021-04-01 08:42:00 -07:00 committed by GitHub
parent 8f8a579eee
commit c6a2e45768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 127 additions and 0 deletions

View File

@ -551,6 +551,7 @@ namespace ts {
case SyntaxKind.JSDocPrivateTag:
case SyntaxKind.JSDocProtectedTag:
case SyntaxKind.JSDocReadonlyTag:
case SyntaxKind.JSDocDeprecatedTag:
return visitNode(cbNode, (node as JSDocTag).tagName)
|| (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray<JSDocText | JSDocLink> | undefined));
case SyntaxKind.PartiallyEmittedExpression:

View File

@ -0,0 +1,111 @@
[
{
"marker": {
"fileName": "/tests/cases/fourslash/quickInfoInheritedLinkTag.ts",
"position": 258,
"name": ""
},
"quickInfo": {
"kind": "method",
"kindModifiers": "deprecated",
"textSpan": {
"start": 257,
"length": 1
},
"displayParts": [
{
"text": "(",
"kind": "punctuation"
},
{
"text": "method",
"kind": "text"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "C",
"kind": "className"
},
{
"text": ".",
"kind": "punctuation"
},
{
"text": "m",
"kind": "methodName"
},
{
"text": "(",
"kind": "punctuation"
},
{
"text": ")",
"kind": "punctuation"
},
{
"text": ":",
"kind": "punctuation"
},
{
"text": " ",
"kind": "space"
},
{
"text": "void",
"kind": "keyword"
}
],
"documentation": [],
"tags": [
{
"name": "deprecated",
"text": [
{
"text": "Use ",
"kind": "text"
},
{
"text": "{@link ",
"kind": "link"
},
{
"text": "PerspectiveCamera#setFocalLength .setFocalLength()",
"kind": "linkText"
},
{
"text": "}",
"kind": "link"
},
{
"text": " and ",
"kind": "text"
},
{
"text": "{@link ",
"kind": "link"
},
{
"text": "PerspectiveCamera#filmGauge .filmGauge",
"kind": "linkText"
},
{
"text": "}",
"kind": "link"
},
{
"text": " instead.",
"kind": "text"
}
]
}
]
}
}
]

View File

@ -0,0 +1,15 @@
///<reference path="fourslash.ts" />
//// export class C {
//// /**
//// * @deprecated Use {@link PerspectiveCamera#setFocalLength .setFocalLength()} and {@link PerspectiveCamera#filmGauge .filmGauge} instead.
//// */
//// m() { }
//// }
//// export class D extends C {
//// m() { } // crashes here
//// }
//// new C().m/**/ // and here (with a different thing trying to access undefined)
verify.noErrors()
verify.baselineQuickInfo();