@@ -904,6 +904,7 @@ namespace ts {
904
904
function visit ( node : Node ) : void {
905
905
switch ( node . kind ) {
906
906
case SyntaxKind . FunctionDeclaration :
907
+ case SyntaxKind . FunctionExpression :
907
908
case SyntaxKind . MethodDeclaration :
908
909
case SyntaxKind . MethodSignature :
909
910
const functionDeclaration = < FunctionLikeDeclaration > node ;
@@ -930,6 +931,7 @@ namespace ts {
930
931
break ;
931
932
932
933
case SyntaxKind . ClassDeclaration :
934
+ case SyntaxKind . ClassExpression :
933
935
case SyntaxKind . InterfaceDeclaration :
934
936
case SyntaxKind . TypeAliasDeclaration :
935
937
case SyntaxKind . EnumDeclaration :
@@ -944,34 +946,25 @@ namespace ts {
944
946
case SyntaxKind . SetAccessor :
945
947
case SyntaxKind . TypeLiteral :
946
948
addDeclaration ( < Declaration > node ) ;
947
- // fall through
948
- case SyntaxKind . Constructor :
949
- case SyntaxKind . VariableStatement :
950
- case SyntaxKind . VariableDeclarationList :
951
- case SyntaxKind . ObjectBindingPattern :
952
- case SyntaxKind . ArrayBindingPattern :
953
- case SyntaxKind . ModuleBlock :
954
949
forEachChild ( node , visit ) ;
955
950
break ;
956
951
957
- case SyntaxKind . Block :
958
- if ( isFunctionBlock ( node ) ) {
959
- forEachChild ( node , visit ) ;
960
- }
961
- break ;
962
-
963
952
case SyntaxKind . Parameter :
964
953
// Only consider parameter properties
965
954
if ( ! ( node . flags & NodeFlags . ParameterPropertyModifier ) ) {
966
955
break ;
967
956
}
968
957
// fall through
969
958
case SyntaxKind . VariableDeclaration :
970
- case SyntaxKind . BindingElement :
971
- if ( isBindingPattern ( ( < VariableDeclaration > node ) . name ) ) {
972
- forEachChild ( ( < VariableDeclaration > node ) . name , visit ) ;
959
+ case SyntaxKind . BindingElement : {
960
+ const decl = < VariableDeclaration > node ;
961
+ if ( isBindingPattern ( decl . name ) ) {
962
+ forEachChild ( decl . name , visit ) ;
973
963
break ;
974
964
}
965
+ if ( decl . initializer )
966
+ visit ( decl . initializer ) ;
967
+ }
975
968
case SyntaxKind . EnumMember :
976
969
case SyntaxKind . PropertyDeclaration :
977
970
case SyntaxKind . PropertySignature :
@@ -1008,6 +1001,9 @@ namespace ts {
1008
1001
}
1009
1002
}
1010
1003
break ;
1004
+
1005
+ default :
1006
+ forEachChild ( node , visit ) ;
1011
1007
}
1012
1008
}
1013
1009
}
@@ -2770,7 +2766,9 @@ namespace ts {
2770
2766
/* @internal */ export function getNodeKind ( node : Node ) : string {
2771
2767
switch ( node . kind ) {
2772
2768
case SyntaxKind . ModuleDeclaration : return ScriptElementKind . moduleElement ;
2773
- case SyntaxKind . ClassDeclaration : return ScriptElementKind . classElement ;
2769
+ case SyntaxKind . ClassDeclaration :
2770
+ case SyntaxKind . ClassExpression :
2771
+ return ScriptElementKind . classElement ;
2774
2772
case SyntaxKind . InterfaceDeclaration : return ScriptElementKind . interfaceElement ;
2775
2773
case SyntaxKind . TypeAliasDeclaration : return ScriptElementKind . typeElement ;
2776
2774
case SyntaxKind . EnumDeclaration : return ScriptElementKind . enumElement ;
@@ -2780,7 +2778,9 @@ namespace ts {
2780
2778
: isLet ( node )
2781
2779
? ScriptElementKind . letElement
2782
2780
: ScriptElementKind . variableElement ;
2783
- case SyntaxKind . FunctionDeclaration : return ScriptElementKind . functionElement ;
2781
+ case SyntaxKind . FunctionDeclaration :
2782
+ case SyntaxKind . FunctionExpression :
2783
+ return ScriptElementKind . functionElement ;
2784
2784
case SyntaxKind . GetAccessor : return ScriptElementKind . memberGetAccessorElement ;
2785
2785
case SyntaxKind . SetAccessor : return ScriptElementKind . memberSetAccessorElement ;
2786
2786
case SyntaxKind . MethodDeclaration :
0 commit comments