Skip to content

Commit 81a43f0

Browse files
author
Andy Hanson
committed
Look for declaration expressions in nested expressions
1 parent 3e32a61 commit 81a43f0

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/services/services.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -946,22 +946,9 @@ namespace ts {
946946
case SyntaxKind.SetAccessor:
947947
case SyntaxKind.TypeLiteral:
948948
addDeclaration(<Declaration>node);
949-
// fall through
950-
case SyntaxKind.Constructor:
951-
case SyntaxKind.VariableStatement:
952-
case SyntaxKind.VariableDeclarationList:
953-
case SyntaxKind.ObjectBindingPattern:
954-
case SyntaxKind.ArrayBindingPattern:
955-
case SyntaxKind.ModuleBlock:
956949
forEachChild(node, visit);
957950
break;
958951

959-
case SyntaxKind.Block:
960-
if (isFunctionBlock(node)) {
961-
forEachChild(node, visit);
962-
}
963-
break;
964-
965952
case SyntaxKind.Parameter:
966953
// Only consider parameter properties
967954
if (!(node.flags & NodeFlags.ParameterPropertyModifier)) {
@@ -1014,6 +1001,9 @@ namespace ts {
10141001
}
10151002
}
10161003
break;
1004+
1005+
default:
1006+
forEachChild(node, visit);
10171007
}
10181008
}
10191009
}

tests/cases/fourslash/declarationExpressions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
////};
77
////function D() {}
88
////const E = function F() {}
9+
////console.log(function inner() {})
10+
911

1012
// Search for properties defined in the constructor, but not other constructor paramters
1113
var searchValue = "search";
@@ -17,3 +19,5 @@ verify.navigationItemsListContains("x", "property", "x", "exact");
1719
verify.navigationItemsListContains("D", "function", "D", "exact");
1820
verify.navigationItemsListContains("E", "const", "E", "exact");
1921
verify.navigationItemsListContains("F", "function", "F", "exact")
22+
23+
verify.navigationItemsListContains("inner", "function", "inner", "exact");

0 commit comments

Comments
 (0)