Commit 01ff213a authored by David Chase's avatar David Chase

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 <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarJeremy Faller <jeremy@golang.org>
parent ab00f89c
...@@ -716,6 +716,7 @@ func binarySearch(n int, out *Nodes, less func(i int) *Node, base func(i int, ni ...@@ -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++ { for i := lo; i < hi; i++ {
nif := nod(OIF, nil, nil) nif := nod(OIF, nil, nil)
base(i, nif) base(i, nif)
lineno = lineno.WithNotStmt()
nif.Left = typecheck(nif.Left, ctxExpr) nif.Left = typecheck(nif.Left, ctxExpr)
nif.Left = defaultlit(nif.Left, nil) nif.Left = defaultlit(nif.Left, nil)
out.Append(nif) out.Append(nif)
...@@ -727,6 +728,7 @@ func binarySearch(n int, out *Nodes, less func(i int) *Node, base func(i int, ni ...@@ -727,6 +728,7 @@ func binarySearch(n int, out *Nodes, less func(i int) *Node, base func(i int, ni
half := lo + n/2 half := lo + n/2
nif := nod(OIF, nil, nil) nif := nod(OIF, nil, nil)
nif.Left = less(half) nif.Left = less(half)
lineno = lineno.WithNotStmt()
nif.Left = typecheck(nif.Left, ctxExpr) nif.Left = typecheck(nif.Left, ctxExpr)
nif.Left = defaultlit(nif.Left, nil) nif.Left = defaultlit(nif.Left, nil)
do(lo, half, &nif.Nbody) do(lo, half, &nif.Nbody)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment