Commit 41943d96 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: 's avatarDavid Crawshaw <crawshaw@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 67bcee8d
......@@ -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)
......
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