fmt: keep __global in struct declarations (#8584)

pull/8591/head
Lukas Neubert 2021-02-05 16:46:43 +01:00 committed by GitHub
parent 76ea3e7b41
commit 9ab1d17cbc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 0 deletions

View File

@ -201,6 +201,7 @@ pub:
mut_pos int // mut:
pub_pos int // pub:
pub_mut_pos int // pub mut:
global_pos int // __global:
module_pos int // module:
language table.Language
is_union bool

View File

@ -687,6 +687,8 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl) {
f.writeln('pub:')
} else if i == node.pub_mut_pos {
f.writeln('pub mut:')
} else if i == node.global_pos {
f.writeln('__global:')
} else if i == node.module_pos {
f.writeln('module:')
}

View File

@ -0,0 +1,5 @@
struct Foo {
a int
__global:
g string
}

View File

@ -323,6 +323,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
mut_pos: mut_pos - embeds.len
pub_pos: pub_pos - embeds.len
pub_mut_pos: pub_mut_pos - embeds.len
global_pos: global_pos - embeds.len
module_pos: module_pos - embeds.len
language: language
is_union: is_union