Commit 7ac2e413 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: minor cleanup in widstruct

Change-Id: I9e52a2c52b754568412d719b415f91a998d247fe
Reviewed-on: https://go-review.googlesource.com/38467
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 89953248
......@@ -79,7 +79,6 @@ func widstruct(errtype *Type, t *Type, o int64, flag int) int64 {
maxalign = 1
}
lastzero := int64(0)
var w int64
for _, f := range t.Fields().Slice() {
if f.Type == nil {
// broken field, just skip it so that other valid fields
......@@ -91,10 +90,6 @@ func widstruct(errtype *Type, t *Type, o int64, flag int) int64 {
if int32(f.Type.Align) > maxalign {
maxalign = int32(f.Type.Align)
}
if f.Type.Width < 0 {
Fatalf("invalid width %d", f.Type.Width)
}
w = f.Type.Width
if f.Type.Align > 0 {
o = Rnd(o, int64(f.Type.Align))
}
......@@ -115,6 +110,10 @@ func widstruct(errtype *Type, t *Type, o int64, flag int) int64 {
}
}
w := f.Type.Width
if w < 0 {
Fatalf("invalid width %d", f.Type.Width)
}
if w == 0 {
lastzero = o
}
......
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