aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/gen.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-01-06 18:04:58 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-01-11 16:30:08 +0100
commit14cc59eef8374ac8013a05d5d14c4cd4af9d0979 (patch)
tree558db1b673e2b96ddefd7cb4776b7d6fe28ca9ec /pkg/compiler/gen.go
parent1a2fb60b1e34cbc7f21351da8f9e3e253173bde8 (diff)
pkg/compiler: prohibit use of direction attribute on union fields
Direction attributes on unions work in a confusing way and don't do what users may think they do. Now we have out_overlay attribute for structs that allows to have overlapping input and output fields.
Diffstat (limited to 'pkg/compiler/gen.go')
-rw-r--r--pkg/compiler/gen.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/compiler/gen.go b/pkg/compiler/gen.go
index 78cbc54fe..89571c966 100644
--- a/pkg/compiler/gen.go
+++ b/pkg/compiler/gen.go
@@ -456,7 +456,7 @@ func genPad(size uint64) prog.Field {
func (comp *compiler) genFieldArray(fields []*ast.Field, argSizes []uint64) ([]prog.Field, int) {
outOverlay := -1
for i, f := range fields {
- attrs := comp.parseAttrs(fieldAttrs, f, f.Attrs)
+ attrs := comp.parseAttrs(structFieldAttrs, f, f.Attrs)
if attrs[attrOutOverlay] > 0 {
outOverlay = i
}
@@ -476,7 +476,7 @@ func (comp *compiler) genFieldArray(fields []*ast.Field, argSizes []uint64) ([]p
}
func (comp *compiler) genFieldDir(f *ast.Field) (prog.Dir, bool) {
- attrs := comp.parseAttrs(fieldAttrs, f, f.Attrs)
+ attrs := comp.parseAttrs(structFieldAttrs, f, f.Attrs)
switch {
case attrs[attrIn] != 0:
return prog.DirIn, true