mirror of
https://github.com/vlang/v.git
synced 2025-09-15 15:32:27 +03:00
vfmt: remove empty __global()
(#20004)
This commit is contained in:
parent
52e41f8879
commit
f0e4438e08
2 changed files with 1 additions and 6 deletions
|
@ -1221,12 +1221,11 @@ pub fn (mut f Fmt) for_stmt(node ast.ForStmt) {
|
||||||
pub fn (mut f Fmt) global_decl(node ast.GlobalDecl) {
|
pub fn (mut f Fmt) global_decl(node ast.GlobalDecl) {
|
||||||
f.attrs(node.attrs)
|
f.attrs(node.attrs)
|
||||||
if node.fields.len == 0 && node.pos.line_nr == node.pos.last_line {
|
if node.fields.len == 0 && node.pos.line_nr == node.pos.last_line {
|
||||||
f.writeln('__global ()')
|
// remove "__global()"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f.write('__global ')
|
f.write('__global ')
|
||||||
mut max := 0
|
mut max := 0
|
||||||
// mut has_assign := false
|
|
||||||
if node.is_block {
|
if node.is_block {
|
||||||
f.writeln('(')
|
f.writeln('(')
|
||||||
f.indent++
|
f.indent++
|
||||||
|
@ -1234,9 +1233,6 @@ pub fn (mut f Fmt) global_decl(node ast.GlobalDecl) {
|
||||||
if field.name.len > max {
|
if field.name.len > max {
|
||||||
max = field.name.len
|
max = field.name.len
|
||||||
}
|
}
|
||||||
// if field.has_expr {
|
|
||||||
// has_assign = true
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for field in node.fields {
|
for field in node.fields {
|
||||||
|
|
|
@ -4,7 +4,6 @@ struct TestInt {
|
||||||
|
|
||||||
__global x = bool(true)
|
__global x = bool(true)
|
||||||
__global y f32
|
__global y f32
|
||||||
__global ()
|
|
||||||
__global (
|
__global (
|
||||||
spam string
|
spam string
|
||||||
foo = int(5)
|
foo = int(5)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue