From 01ff213a51a6713958f80619f483eb2e731e034a Mon Sep 17 00:00:00 2001 From: David Chase Date: Thu, 3 Oct 2019 12:19:42 -0400 Subject: [PATCH] cmd/compile: suppress statement marks on interior of switch tree 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 TryBot-Result: Gobot Gobot Reviewed-by: Jeremy Faller --- src/cmd/compile/internal/gc/swt.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cmd/compile/internal/gc/swt.go b/src/cmd/compile/internal/gc/swt.go index efd97e6b78..2970993056 100644 --- a/src/cmd/compile/internal/gc/swt.go +++ b/src/cmd/compile/internal/gc/swt.go @@ -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) -- 2.50.0