From 14cc59eef8374ac8013a05d5d14c4cd4af9d0979 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 6 Jan 2022 18:04:58 +0100 Subject: 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. --- pkg/compiler/gen.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkg/compiler/gen.go') 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 -- cgit mrf-deployment