File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8091,13 +8091,22 @@ namespace ts {
80918091 return expression;
80928092 }
80938093
8094+ function getControlFlowContainer(node: Node): Node {
8095+ while (true) {
8096+ node = node.parent;
8097+ if (isFunctionLike(node) || node.kind === SyntaxKind.ModuleBlock || node.kind === SyntaxKind.SourceFile || node.kind === SyntaxKind.PropertyDeclaration) {
8098+ return node;
8099+ }
8100+ }
8101+ }
8102+
80948103 function isDeclarationIncludedInFlow(reference: Node, declaration: Declaration, includeOuterFunctions: boolean) {
8095- const declarationContainer = getContainingFunctionOrModule (declaration);
8096- let container = getContainingFunctionOrModule (reference);
8104+ const declarationContainer = getControlFlowContainer (declaration);
8105+ let container = getControlFlowContainer (reference);
80978106 while (container !== declarationContainer &&
80988107 (container.kind === SyntaxKind.FunctionExpression || container.kind === SyntaxKind.ArrowFunction) &&
80998108 (includeOuterFunctions || getImmediatelyInvokedFunctionExpression(<FunctionExpression>container))) {
8100- container = getContainingFunctionOrModule (container);
8109+ container = getControlFlowContainer (container);
81018110 }
81028111 return container === declarationContainer;
81038112 }
Original file line number Diff line number Diff line change @@ -880,15 +880,6 @@ namespace ts {
880880 }
881881 }
882882
883- export function getContainingFunctionOrModule ( node : Node ) : Node {
884- while ( true ) {
885- node = node . parent ;
886- if ( isFunctionLike ( node ) || node . kind === SyntaxKind . ModuleDeclaration || node . kind === SyntaxKind . SourceFile ) {
887- return node ;
888- }
889- }
890- }
891-
892883 export function getContainingClass ( node : Node ) : ClassLikeDeclaration {
893884 while ( true ) {
894885 node = node . parent ;
You can’t perform that action at this time.
0 commit comments