From: Alberto Donizetti Date: Mon, 12 Oct 2020 12:35:24 +0000 (+0200) Subject: cmd/compile: use Bool accessor in place of Val.U.(bool) X-Git-Tag: go1.16beta1~787 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=349a2876467cdae58a772424f044f882fd4e2f6b;p=gostls13.git cmd/compile: use Bool accessor in place of Val.U.(bool) We have a Bool() accessor for the value in boolean nodes, that we use elsewhere for n.Val().U.(bool), use it here too. Noticed while reading the code. Change-Id: Ie42e014970099a05fe9f02f378af77b63e7e6b13 Reviewed-on: https://go-review.googlesource.com/c/go/+/261360 Trust: Alberto Donizetti Run-TryBot: Alberto Donizetti TryBot-Result: Go Bot Reviewed-by: Robert Griesemer --- diff --git a/src/cmd/compile/internal/gc/swt.go b/src/cmd/compile/internal/gc/swt.go index 138b0acc53..bf0410900f 100644 --- a/src/cmd/compile/internal/gc/swt.go +++ b/src/cmd/compile/internal/gc/swt.go @@ -440,7 +440,7 @@ func (c *exprClause) test(exprname *Node) *Node { // Optimize "switch true { ...}" and "switch false { ... }". if Isconst(exprname, CTBOOL) && !c.lo.Type.IsInterface() { - if exprname.Val().U.(bool) { + if exprname.Bool() { return c.lo } else { return nodl(c.pos, ONOT, c.lo, nil)