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 {
21212121 : undefined ;
21222122 }
21232123
2124- function getSingleInitializerOfVariableStatementOrPropertyDeclaration ( node : Node ) : Expression | undefined {
2124+ export function getSingleInitializerOfVariableStatementOrPropertyDeclaration ( node : Node ) : Expression | undefined {
21252125 switch ( node . kind ) {
21262126 case SyntaxKind . VariableStatement :
21272127 const v = getSingleVariableOfVariableStatement ( node ) ;
Original file line number Diff line number Diff line change @@ -60,9 +60,11 @@ namespace ts.OutliningElementsCollector {
6060 }
6161
6262 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 ;
6668 }
6769 }
6870
You can’t perform that action at this time.
0 commit comments