diff --git a/compiler/ast/package.go b/compiler/ast/package.go index 6d3e10e6..989d038f 100644 --- a/compiler/ast/package.go +++ b/compiler/ast/package.go @@ -183,12 +183,16 @@ func flattenStruct(t types.Info) circuit.IO { } for _, f := range t.Struct { - // XXX recursive structs. - result = append(result, circuit.IOArg{ - Name: f.Name, - Type: f.Type.String(), - Size: f.Type.Bits, - }) + if f.Type.Type == types.Struct { + ios := flattenStruct(f.Type) + result = append(result, ios...) + } else { + result = append(result, circuit.IOArg{ + Name: f.Name, + Type: f.Type.String(), + Size: f.Type.Bits, + }) + } } return result