Commit 9bffcf38 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: minor cleanup in sinit.go

Passes toolstash -cmp.

Change-Id: Id16009ef3ef1173eafe0f0c578dbf325b61aab3c
Reviewed-on: https://go-review.googlesource.com/20674
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarDave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 0d2e92c2
......@@ -512,28 +512,11 @@ func staticname(t *Type, ctxt int) *Node {
func isliteral(n *Node) bool {
// Treat nils as zeros rather than literals.
if n.Op == OLITERAL {
if n.Val().Ctype() != CTNIL {
return true
}
}
return false
return n.Op == OLITERAL && n.Val().Ctype() != CTNIL
}
func simplename(n *Node) bool {
if n.Op != ONAME {
return false
}
if !n.Addable {
return false
}
if n.Class&PHEAP != 0 {
return false
}
if n.Class == PPARAMREF {
return false
}
return true
return n.Op == ONAME && n.Addable && n.Class&PHEAP == 0 && n.Class != PPARAMREF
}
func litas(l *Node, r *Node, init *Nodes) {
......@@ -1442,22 +1425,11 @@ func gen_as_init(n *Node, reportOnly bool) bool {
default:
goto no
case TBOOL,
TINT8,
TUINT8,
TINT16,
TUINT16,
TINT32,
TUINT32,
TINT64,
TUINT64,
TINT,
TUINT,
TUINTPTR,
TPTR32,
TPTR64,
TFLOAT32,
TFLOAT64:
case TBOOL, TINT8, TUINT8, TINT16, TUINT16,
TINT32, TUINT32, TINT64, TUINT64,
TINT, TUINT, TUINTPTR,
TPTR32, TPTR64,
TFLOAT32, TFLOAT64:
if !reportOnly {
gdata(&nam, nr, int(nr.Type.Width))
}
......
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