@@ -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 ;
@@ -920,11 +929,11 @@ namespace ts {
920
929
}
921
930
922
931
function createBranchLabel ( ) : FlowLabel {
923
- return { flags : FlowFlags . BranchLabel , antecedents : undefined } ;
932
+ return initFlowNode ( { flags : FlowFlags . BranchLabel , antecedents : undefined } ) ;
924
933
}
925
934
926
935
function createLoopLabel ( ) : FlowLabel {
927
- return { flags : FlowFlags . LoopLabel , antecedents : undefined } ;
936
+ return initFlowNode ( { flags : FlowFlags . LoopLabel , antecedents : undefined } ) ;
928
937
}
929
938
930
939
function setFlowNodeReferenced ( flow : FlowNode ) {
@@ -1194,7 +1203,7 @@ namespace ts {
1194
1203
// as possible antecedents of the start of the `catch` or `finally` blocks.
1195
1204
// Don't bother intercepting the call if there's no finally or catch block that needs the information
1196
1205
if ( node . catchClause || node . finallyBlock ) {
1197
- flowNodeCreated = node => ( tryPriors . push ( node ) , node ) ;
1206
+ flowNodeCreated = node => ( tryPriors . push ( node ) , initFlowNode ( node ) ) ;
1198
1207
}
1199
1208
bind ( node . tryBlock ) ;
1200
1209
flowNodeCreated = oldFlowNodeCreated ;
@@ -1263,7 +1272,7 @@ namespace ts {
1263
1272
//
1264
1273
// extra edges that we inject allows to control this behavior
1265
1274
// 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.
1266
- const preFinallyFlow : PreFinallyFlow = { flags : FlowFlags . PreFinally , antecedent : preFinallyPrior , lock : { } } ;
1275
+ const preFinallyFlow : PreFinallyFlow = initFlowNode ( { flags : FlowFlags . PreFinally , antecedent : preFinallyPrior , lock : { } } ) ;
1267
1276
addAntecedent ( preFinallyLabel , preFinallyFlow ) ;
1268
1277
1269
1278
currentFlow = finishFlowLabel ( preFinallyLabel ) ;
@@ -1984,7 +1993,7 @@ namespace ts {
1984
1993
const host = getJSDocHost ( typeAlias ) ;
1985
1994
container = findAncestor ( host . parent , n => ! ! ( getContainerFlags ( n ) & ContainerFlags . IsContainer ) ) || file ;
1986
1995
blockScopeContainer = getEnclosingBlockScopeContainer ( host ) || file ;
1987
- currentFlow = { flags : FlowFlags . Start } ;
1996
+ currentFlow = initFlowNode ( { flags : FlowFlags . Start } ) ;
1988
1997
parent = typeAlias ;
1989
1998
bind ( typeAlias . typeExpression ) ;
1990
1999
const declName = getNameOfDeclaration ( typeAlias ) ;
0 commit comments