File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2121,7 +2121,7 @@ namespace ts {
2121
2121
: undefined ;
2122
2122
}
2123
2123
2124
- function getSingleInitializerOfVariableStatementOrPropertyDeclaration ( node : Node ) : Expression | undefined {
2124
+ export function getSingleInitializerOfVariableStatementOrPropertyDeclaration ( node : Node ) : Expression | undefined {
2125
2125
switch ( node . kind ) {
2126
2126
case SyntaxKind . VariableStatement :
2127
2127
const v = getSingleVariableOfVariableStatement ( node ) ;
Original file line number Diff line number Diff line change @@ -60,9 +60,11 @@ namespace ts.OutliningElementsCollector {
60
60
}
61
61
62
62
function isFunctionExpressionAssignedToVariable ( n : Node ) {
63
- return ( isFunctionExpression ( n ) || isArrowFunction ( n ) ) &&
64
- n . parent && n . parent . parent && n . parent . parent . parent &&
65
- isVariableStatement ( n . parent . parent . parent ) ;
63
+ if ( ! isFunctionExpression ( n ) && ! isArrowFunction ( n ) ) {
64
+ return false ;
65
+ }
66
+ const ancestor = findAncestor ( n , isVariableStatement ) ;
67
+ return ! ! ancestor && getSingleInitializerOfVariableStatementOrPropertyDeclaration ( ancestor ) === n ;
66
68
}
67
69
}
68
70
You can’t perform that action at this time.
0 commit comments