mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-12 11:50:54 -06:00
In the binder, unreachable code mistakenly skips the `bindJSDoc` call in `bindChildrenWorker`, which sets parent pointers. The fix is to call `bindJSDoc` in the case of unreachable code as well.
This commit is contained in:
parent
bde81deed2
commit
6d92a2942f
@ -640,6 +640,7 @@ namespace ts {
|
||||
function bindChildrenWorker(node: Node): void {
|
||||
if (checkUnreachable(node)) {
|
||||
bindEachChild(node);
|
||||
bindJSDoc(node);
|
||||
return;
|
||||
}
|
||||
switch (node.kind) {
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
=== tests/cases/conformance/jsdoc/bug27341.js ===
|
||||
if (false) {
|
||||
/**
|
||||
* @param {string} s
|
||||
*/
|
||||
const x = function (s) {
|
||||
>x : Symbol(x, Decl(bug27341.js, 4, 9))
|
||||
>s : Symbol(s, Decl(bug27341.js, 4, 24))
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
=== tests/cases/conformance/jsdoc/bug27341.js ===
|
||||
if (false) {
|
||||
>false : false
|
||||
|
||||
/**
|
||||
* @param {string} s
|
||||
*/
|
||||
const x = function (s) {
|
||||
>x : (s: string) => void
|
||||
>function (s) { } : (s: string) => void
|
||||
>s : string
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
// @allowJs: true
|
||||
// @noEmit: true
|
||||
// @checkJs: true
|
||||
// @Filename: bug27341.js
|
||||
if (false) {
|
||||
/**
|
||||
* @param {string} s
|
||||
*/
|
||||
const x = function (s) {
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user