mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fmt: keep volatile
qualifier in global declarations (#15947)
This commit is contained in:
parent
a7ad64033e
commit
8a38bc2324
@ -1103,6 +1103,9 @@ pub fn (mut f Fmt) global_decl(node ast.GlobalDecl) {
|
||||
}
|
||||
for field in node.fields {
|
||||
f.comments(field.comments, inline: true)
|
||||
if field.is_volatile {
|
||||
f.write('volatile ')
|
||||
}
|
||||
f.write('$field.name ')
|
||||
f.write(strings.repeat(` `, max - field.name.len))
|
||||
if field.has_expr {
|
||||
|
@ -1,3 +1,7 @@
|
||||
struct TestInt {
|
||||
i int
|
||||
}
|
||||
|
||||
__global x = bool(true)
|
||||
__global y f32
|
||||
__global ()
|
||||
@ -6,5 +10,8 @@ __global (
|
||||
foo = int(5)
|
||||
)
|
||||
__global (
|
||||
a int
|
||||
a int
|
||||
volatile test_int = TestInt{
|
||||
i: 0
|
||||
}
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user