aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/check.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-03-02 11:49:19 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-03-05 12:10:27 +0100
commit5110ff445ddb5a09a13e17b187c06d2dc3a7d52a (patch)
tree4a482d23c3e284e996539a1677dee246e9e7b0a5 /pkg/compiler/check.go
parentdb01d57e9144125b368d14815d08e897ff496604 (diff)
pkg/compiler: switch attributes from Ident to Type
This allows parametrized attributes like size[10]. But this is not used for now.
Diffstat (limited to 'pkg/compiler/check.go')
-rw-r--r--pkg/compiler/check.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go
index 57ef5b995..58738fa3e 100644
--- a/pkg/compiler/check.go
+++ b/pkg/compiler/check.go
@@ -535,6 +535,12 @@ func (comp *compiler) checkStruct(ctx checkCtx, n *ast.Struct) {
for _, f := range n.Fields {
comp.checkType(ctx, f.Type, flags)
}
+ for _, attr := range n.Attrs {
+ if attr.Ident == "" || attr.HasColon {
+ comp.error(attr.Pos, "bad struct/union attribute")
+ return
+ }
+ }
if n.IsUnion {
comp.parseUnionAttrs(n)
} else {