• Andrew Gerrand's avatar
    cmd/cover: fix counting of blocks split by goto statements · 98100c56
    Andrew Gerrand authored
    When adding coverage counters to a block, the block's statement list is
    mutated. CL 77150 removed the part where the mutated list is assigned
    back to its parent node; this was confusing ast.Walk, which would then
    lose its place and stop walking the current block, dropping counters in
    the process.
    
    This change has addCounters make a copy of the list before mutating
    it, so that the original list doesn't change under Walk's feet.
    
    Fix #32200
    
    Change-Id: Ia3b67d8cee860ceb7caf8748cb7a80ff9c6276e0
    Reviewed-on: https://go-review.googlesource.com/c/go/+/179581Reviewed-by: 's avatarRob Pike <r@golang.org>
    98100c56
Name
Last commit
Last update
..
testdata Loading commit data...
cover.go Loading commit data...
cover_test.go Loading commit data...
doc.go Loading commit data...
func.go Loading commit data...
html.go Loading commit data...
profile.go Loading commit data...