@@ -161,7 +161,12 @@ namespace ts {
161
161
IsObjectLiteralOrClassExpressionMethod = 1 << 7 ,
162
162
}
163
163
164
- let flowNodeCreated : < T extends FlowNode > ( node : T ) => T = identity ;
164
+ function initFlowNode < T extends FlowNode > ( node : T ) {
165
+ Debug . attachFlowNodeDebugInfo ( node ) ;
166
+ return node ;
167
+ }
168
+
169
+ let flowNodeCreated : < T extends FlowNode > ( node : T ) => T = initFlowNode ;
165
170
166
171
const binder = createBinder ( ) ;
167
172
@@ -238,6 +243,10 @@ namespace ts {
238
243
239
244
Symbol = objectAllocator . getSymbolConstructor ( ) ;
240
245
246
+ // Attach debugging information if necessary
247
+ Debug . attachFlowNodeDebugInfo ( unreachableFlow ) ;
248
+ Debug . attachFlowNodeDebugInfo ( reportedUnreachableFlow ) ;
249
+
241
250
if ( ! file . locals ) {
242
251
bind ( file ) ;
243
252
file . symbolCount = symbolCount ;
@@ -626,7 +635,7 @@ namespace ts {
626
635
// A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave
627
636
// similarly to break statements that exit to a label just past the statement body.
628
637
if ( ! isIIFE ) {
629
- currentFlow = { flags : FlowFlags . Start } ;
638
+ currentFlow = initFlowNode ( { flags : FlowFlags . Start } ) ;
630
639
if ( containerFlags & ( ContainerFlags . IsFunctionExpression | ContainerFlags . IsObjectLiteralOrClassExpressionMethod ) ) {
631
640
currentFlow . node = < FunctionExpression | ArrowFunction | MethodDeclaration > node ;
632
641
}
@@ -638,7 +647,7 @@ namespace ts {
638
647
currentContinueTarget = undefined ;
639
648
activeLabels = undefined ;
640
649
hasExplicitReturn = false ;
641
- flowNodeCreated = identity ;
650
+ flowNodeCreated = initFlowNode ;
642
651
bindChildren ( node ) ;
643
652
// Reset all reachability check related flags on node (for incremental scenarios)
644
653
node . flags &= ~ NodeFlags . ReachabilityAndEmitFlags ;
@@ -919,11 +928,11 @@ namespace ts {
919
928
}
920
929
921
930
function createBranchLabel ( ) : FlowLabel {
922
- return { flags : FlowFlags . BranchLabel , antecedents : undefined } ;
931
+ return initFlowNode ( { flags : FlowFlags . BranchLabel , antecedents : undefined } ) ;
923
932
}
924
933
925
934
function createLoopLabel ( ) : FlowLabel {
926
- return { flags : FlowFlags . LoopLabel , antecedents : undefined } ;
935
+ return initFlowNode ( { flags : FlowFlags . LoopLabel , antecedents : undefined } ) ;
927
936
}
928
937
929
938
function setFlowNodeReferenced ( flow : FlowNode ) {
@@ -1193,7 +1202,7 @@ namespace ts {
1193
1202
// as possible antecedents of the start of the `catch` or `finally` blocks.
1194
1203
// Don't bother intercepting the call if there's no finally or catch block that needs the information
1195
1204
if ( node . catchClause || node . finallyBlock ) {
1196
- flowNodeCreated = node => ( tryPriors . push ( node ) , node ) ;
1205
+ flowNodeCreated = node => ( tryPriors . push ( node ) , initFlowNode ( node ) ) ;
1197
1206
}
1198
1207
bind ( node . tryBlock ) ;
1199
1208
flowNodeCreated = oldFlowNodeCreated ;
@@ -1262,7 +1271,7 @@ namespace ts {
1262
1271
//
1263
1272
// extra edges that we inject allows to control this behavior
1264
1273
// if when walking the flow we step on post-finally edge - we can mark matching pre-finally edge as locked so it will be skipped.
1265
- const preFinallyFlow : PreFinallyFlow = { flags : FlowFlags . PreFinally , antecedent : preFinallyPrior , lock : { } } ;
1274
+ const preFinallyFlow : PreFinallyFlow = initFlowNode ( { flags : FlowFlags . PreFinally , antecedent : preFinallyPrior , lock : { } } ) ;
1266
1275
addAntecedent ( preFinallyLabel , preFinallyFlow ) ;
1267
1276
1268
1277
currentFlow = finishFlowLabel ( preFinallyLabel ) ;
@@ -1983,7 +1992,7 @@ namespace ts {
1983
1992
const host = getJSDocHost ( typeAlias ) ;
1984
1993
container = findAncestor ( host . parent , n => ! ! ( getContainerFlags ( n ) & ContainerFlags . IsContainer ) ) || file ;
1985
1994
blockScopeContainer = getEnclosingBlockScopeContainer ( host ) || file ;
1986
- currentFlow = { flags : FlowFlags . Start } ;
1995
+ currentFlow = initFlowNode ( { flags : FlowFlags . Start } ) ;
1987
1996
parent = typeAlias ;
1988
1997
bind ( typeAlias . typeExpression ) ;
1989
1998
const declName = getNameOfDeclaration ( typeAlias ) ;
0 commit comments