diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-03-02 15:44:54 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-03-05 12:10:27 +0100 |
| commit | 5ef8dbdf5a63ccf7e069527dbb2493dc2ef0c319 (patch) | |
| tree | 25f38d85ac74951764770ed777033ee8ed9ac542 /pkg/compiler/consts.go | |
| parent | a339951e5f3c045290340330bcea3ff4155b8334 (diff) | |
pkg/compiler: support size attribute for unions
Diffstat (limited to 'pkg/compiler/consts.go')
| -rw-r--r-- | pkg/compiler/consts.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/compiler/consts.go b/pkg/compiler/consts.go index 789674578..1b008bd4f 100644 --- a/pkg/compiler/consts.go +++ b/pkg/compiler/consts.go @@ -87,7 +87,7 @@ func (comp *compiler) extractConsts() map[string]*ConstInfo { switch n := decl.(type) { case *ast.Struct: for _, attr := range n.Attrs { - if !n.IsUnion && attr.Ident == "size" { + if attr.Ident == "size" { info := getConstInfo(infos, attr.Pos) info.consts[attr.Args[0].Ident] = true } @@ -199,7 +199,7 @@ func (comp *compiler) patchConsts(consts map[string]uint64) { } if n, ok := decl.(*ast.Struct); ok { for _, attr := range n.Attrs { - if !n.IsUnion && attr.Ident == "size" { + if attr.Ident == "size" { sz := attr.Args[0] comp.patchIntConst(sz.Pos, &sz.Value, &sz.Ident, consts, &missing) |
