diff options
Diffstat (limited to 'nexgb/xgbgen/go_struct.go')
-rw-r--r-- | nexgb/xgbgen/go_struct.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nexgb/xgbgen/go_struct.go b/nexgb/xgbgen/go_struct.go index 1e43199..9884194 100644 --- a/nexgb/xgbgen/go_struct.go +++ b/nexgb/xgbgen/go_struct.go @@ -104,7 +104,11 @@ func (s *Struct) WriteListSize(c *Context) { c.Putln("// Struct list size %s", s.SrcName()) c.Putln("func %sListSize(list []%s) int {", s.SrcName(), s.SrcName()) c.Putln("size := 0") - c.Putln("for _, item := range list {") + if s.Size().Expression.Concrete() { + c.Putln("for _ = range list {") + } else { + c.Putln("for _, item := range list {") + } c.Putln("size += %s", s.Size().Reduce("item.")) c.Putln("}") c.Putln("return size") |