From: David Chase Date: Thu, 3 Oct 2019 16:19:42 +0000 (-0400) Subject: cmd/compile: suppress statement marks on interior of switch tree X-Git-Tag: go1.14beta1~829 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=01ff213a51a6713958f80619f483eb2e731e034a;p=gostls13.git 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 --- 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)