vfmt: fix `union {}` declarations

pull/6729/head
Delyan Angelov 2020-11-03 00:35:03 +02:00
parent 4ccb219079
commit ae241785bf
2 changed files with 9 additions and 1 deletions

View File

@ -572,7 +572,11 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) {
if node.is_pub {
f.write('pub ')
}
f.write('struct ')
if node.is_union {
f.write('union ')
} else {
f.write('struct ')
}
f.write_language_prefix(node.language)
name := node.name.after('.')
f.writeln('$name {')

View File

@ -0,0 +1,4 @@
union Un {
i int
b byte
}