@@ -103,7 +103,7 @@ func highlightPath(path []ast.Node, file *ast.File, info *types.Info) (map[posRa
103
103
highlightIdentifier (node , file , info , result )
104
104
case * ast.ForStmt , * ast.RangeStmt :
105
105
highlightLoopControlFlow (path , info , result )
106
- case * ast.SwitchStmt :
106
+ case * ast.SwitchStmt , * ast. TypeSwitchStmt :
107
107
highlightSwitchFlow (path , info , result )
108
108
case * ast.BranchStmt :
109
109
// BREAK can exit a loop, switch or select, while CONTINUE exit a loop so
@@ -309,7 +309,7 @@ func highlightUnlabeledBreakFlow(path []ast.Node, info *types.Info, result map[p
309
309
case * ast.ForStmt , * ast.RangeStmt :
310
310
highlightLoopControlFlow (path , info , result )
311
311
return // only highlight the innermost statement
312
- case * ast.SwitchStmt :
312
+ case * ast.SwitchStmt , * ast. TypeSwitchStmt :
313
313
highlightSwitchFlow (path , info , result )
314
314
return
315
315
case * ast.SelectStmt :
@@ -331,7 +331,7 @@ func highlightLabeledFlow(path []ast.Node, info *types.Info, stmt *ast.BranchStm
331
331
switch label .Stmt .(type ) {
332
332
case * ast.ForStmt , * ast.RangeStmt :
333
333
highlightLoopControlFlow ([]ast.Node {label .Stmt , label }, info , result )
334
- case * ast.SwitchStmt :
334
+ case * ast.SwitchStmt , * ast. TypeSwitchStmt :
335
335
highlightSwitchFlow ([]ast.Node {label .Stmt , label }, info , result )
336
336
}
337
337
return
@@ -381,7 +381,7 @@ Outer:
381
381
switch n .(type ) {
382
382
case * ast.ForStmt , * ast.RangeStmt :
383
383
return loop == n
384
- case * ast.SwitchStmt , * ast.SelectStmt :
384
+ case * ast.SwitchStmt , * ast.TypeSwitchStmt , * ast. SelectStmt :
385
385
return false
386
386
}
387
387
b , ok := n .(* ast.BranchStmt )
@@ -434,7 +434,7 @@ Outer:
434
434
// Reverse walk the path till we get to the switch statement.
435
435
for i := range path {
436
436
switch n := path [i ].(type ) {
437
- case * ast.SwitchStmt :
437
+ case * ast.SwitchStmt , * ast. TypeSwitchStmt :
438
438
switchNodeLabel = labelFor (path [i :])
439
439
if stmtLabel == nil || switchNodeLabel == stmtLabel {
440
440
switchNode = n
@@ -457,7 +457,7 @@ Outer:
457
457
// Traverse AST to find break statements within the same switch.
458
458
ast .Inspect (switchNode , func (n ast.Node ) bool {
459
459
switch n .(type ) {
460
- case * ast.SwitchStmt :
460
+ case * ast.SwitchStmt , * ast. TypeSwitchStmt :
461
461
return switchNode == n
462
462
case * ast.ForStmt , * ast.RangeStmt , * ast.SelectStmt :
463
463
return false
0 commit comments