]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: suppress statement marks on interior of switch tree
authorDavid Chase <drchase@google.com>
Thu, 3 Oct 2019 16:19:42 +0000 (12:19 -0400)
committerDavid Chase <drchase@google.com>
Mon, 7 Oct 2019 22:17:41 +0000 (22:17 +0000)
The lines on nodes within the IF-tree generated for switch
statements looks like control flow so the lines get marked
as statement boundaries.  Except for the first/root comparison,
explicitly disable the marks.

Change-Id: I64b966ed8e427cdc6b816ff6b6a2eb754346edc7
Reviewed-on: https://go-review.googlesource.com/c/go/+/198738
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
src/cmd/compile/internal/gc/swt.go

index efd97e6b78d0f13e0f819da575f578967d8fb5b4..297099305696f0cdd55553143a03654cf47bb217 100644 (file)
@@ -716,6 +716,7 @@ func binarySearch(n int, out *Nodes, less func(i int) *Node, base func(i int, ni
                        for i := lo; i < hi; i++ {
                                nif := nod(OIF, nil, nil)
                                base(i, nif)
+                               lineno = lineno.WithNotStmt()
                                nif.Left = typecheck(nif.Left, ctxExpr)
                                nif.Left = defaultlit(nif.Left, nil)
                                out.Append(nif)
@@ -727,6 +728,7 @@ func binarySearch(n int, out *Nodes, less func(i int) *Node, base func(i int, ni
                half := lo + n/2
                nif := nod(OIF, nil, nil)
                nif.Left = less(half)
+               lineno = lineno.WithNotStmt()
                nif.Left = typecheck(nif.Left, ctxExpr)
                nif.Left = defaultlit(nif.Left, nil)
                do(lo, half, &nif.Nbody)