-
Caio Marcelo de Oliveira Filho authored
When visiting the AST to add counters, there are special cases in which the code calls cuts the walking short by returning nil. In some cases certain nodes are ignored, e.g. Init and Cond inside IfStmt. The fix is to explicitly walk all the children nodes (not only Body and Else) when cutting the current walk. Similar approach was taken with SwitchStmt and TypeSwitchStmt. While the existing test code doesn't handle different counters in the same line, the generated HTML report does it correctly (because it takes column into account). The previous behavior caused lines in function literals to not be tracked when those literals were inside Init or Cond of an IfStmt for example. Fixes #14039. Change-Id: Iad591363330843ad833bd79a0388d709c8d0c8aa Reviewed-on: https://go-review.googlesource.com/19775Reviewed-by: Rob Pike <r@golang.org>
e7f6d8b2