aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/go_struct.go
diff options
context:
space:
mode:
authorAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-06 03:06:02 -0400
committerAndrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu>2012-05-06 03:06:02 -0400
commitea30f1a0a718e5e86343cceac12104baab1bedca (patch)
treecb947c3533bf048336ba0e1c16a53a8c7f35e1ca /nexgb/xgbgen/go_struct.go
parent014a0598bfe6d997a5dacda9eae4591df0b17826 (diff)
downloadhaven-ea30f1a0a718e5e86343cceac12104baab1bedca.tar.gz
haven-ea30f1a0a718e5e86343cceac12104baab1bedca.tar.xz
haven-ea30f1a0a718e5e86343cceac12104baab1bedca.zip
more bug fixes for the rest of the extensions
Diffstat (limited to 'nexgb/xgbgen/go_struct.go')
-rw-r--r--nexgb/xgbgen/go_struct.go6
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")