mirror of
https://github.com/golang/go
synced 2024-09-25 15:20:13 -06:00
cmd/compile: convert getdyn int arg to bool
Passes toolstash -cmp. Change-Id: I5b893b8b82b358534fd85542f05e3aa7e666bcd3 Reviewed-on: https://go-review.googlesource.com/26752 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
67bcee8d98
commit
41943d9639
@ -533,7 +533,9 @@ const (
|
||||
initConst // contains some constant values, which may be written into data symbols
|
||||
)
|
||||
|
||||
func getdyn(n *Node, top int) initGenType {
|
||||
// getdyn calculates the initGenType for n.
|
||||
// If top is false, getdyn is recursing.
|
||||
func getdyn(n *Node, top bool) initGenType {
|
||||
switch n.Op {
|
||||
default:
|
||||
if isliteral(n) {
|
||||
@ -542,7 +544,7 @@ func getdyn(n *Node, top int) initGenType {
|
||||
return initDynamic
|
||||
|
||||
case OARRAYLIT:
|
||||
if top == 0 && n.Type.IsSlice() {
|
||||
if !top && n.Type.IsSlice() {
|
||||
return initDynamic
|
||||
}
|
||||
|
||||
@ -552,7 +554,7 @@ func getdyn(n *Node, top int) initGenType {
|
||||
var mode initGenType
|
||||
for _, n1 := range n.List.Slice() {
|
||||
value := n1.Right
|
||||
mode |= getdyn(value, 0)
|
||||
mode |= getdyn(value, false)
|
||||
if mode == initDynamic|initConst {
|
||||
break
|
||||
}
|
||||
@ -758,7 +760,7 @@ func slicelit(ctxt int, n *Node, var_ *Node, init *Nodes) {
|
||||
// make static initialized array (1),(2)
|
||||
var vstat *Node
|
||||
|
||||
mode := getdyn(n, 1)
|
||||
mode := getdyn(n, true)
|
||||
if mode&initConst != 0 {
|
||||
vstat = staticname(t, ctxt)
|
||||
arraylit(ctxt, 1, n, vstat, init)
|
||||
|
Loading…
Reference in New Issue
Block a user