diff options
author | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-06 03:06:02 -0400 |
---|---|---|
committer | Andrew Gallant (Ocelot) <Andrew.Gallant@tufts.edu> | 2012-05-06 03:06:02 -0400 |
commit | ea30f1a0a718e5e86343cceac12104baab1bedca (patch) | |
tree | cb947c3533bf048336ba0e1c16a53a8c7f35e1ca /nexgb/xgbgen/go_struct.go | |
parent | 014a0598bfe6d997a5dacda9eae4591df0b17826 (diff) | |
download | haven-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.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") |