Skip to content

Fix parent points in unreachable code (#27400) #27406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ namespace ts {
function bindChildrenWorker(node: Node): void {
if (checkUnreachable(node)) {
bindEachChild(node);
bindJSDoc(node);
return;
}
switch (node.kind) {
Expand Down
12 changes: 12 additions & 0 deletions tests/baselines/reference/jsdocBindingInUnreachableCode.symbols
Original file line number Diff line number Diff line change
@@ -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))

};
}

15 changes: 15 additions & 0 deletions tests/baselines/reference/jsdocBindingInUnreachableCode.types
Original file line number Diff line number Diff line change
@@ -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

};
}

11 changes: 11 additions & 0 deletions tests/cases/conformance/jsdoc/jsdocBindingInUnreachableCode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @allowJs: true
// @noEmit: true
// @checkJs: true
// @Filename: bug27341.js
if (false) {
/**
* @param {string} s
*/
const x = function (s) {
};
}