]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix isStaticCompositeLiteral
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 19 Apr 2016 19:08:33 +0000 (12:08 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 19 Apr 2016 20:55:41 +0000 (20:55 +0000)
commit3c6e60c0e41ed42d5df6dcbf134e3a664c08c154
tree7e131b7b5187866724baf92776c2a3261c04a4f8
parent562d398aef1378c781a3164f59f54dd1b0f4638f
cmd/compile: fix isStaticCompositeLiteral

Previously, isStaticCompositeLiteral would
return the wrong value for literals like:

[1]struct{ b []byte }{b: []byte{1}}

Note that the outermost component is an array,
but once we recurse into isStaticCompositeLiteral,
we never check again that arrays are actually arrays.

Instead of adding more logic to the guts of
isStaticCompositeLiteral, allow it to accept
any Node and return the correct answer.

Change-Id: I6af7814a9037bbc7043da9a96137fbee067bbe0e
Reviewed-on: https://go-review.googlesource.com/22247
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/gc/walk.go