Skip to content

Commit

Permalink
vfmt: remove empty __global() (#20004)
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS authored Nov 27, 2023
1 parent 52e41f8 commit f0e4438
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
6 changes: 1 addition & 5 deletions vlib/v/fmt/fmt.v
Original file line number Diff line number Diff line change
Expand Up @@ -1221,22 +1221,18 @@ pub fn (mut f Fmt) for_stmt(node ast.ForStmt) {
pub fn (mut f Fmt) global_decl(node ast.GlobalDecl) {
f.attrs(node.attrs)
if node.fields.len == 0 && node.pos.line_nr == node.pos.last_line {
f.writeln('__global ()')
// remove "__global()"
return
}
f.write('__global ')
mut max := 0
// mut has_assign := false
if node.is_block {
f.writeln('(')
f.indent++
for field in node.fields {
if field.name.len > max {
max = field.name.len
}
// if field.has_expr {
// has_assign = true
//}
}
}
for field in node.fields {
Expand Down
1 change: 0 additions & 1 deletion vlib/v/fmt/tests/global_keep.vv
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ struct TestInt {

__global x = bool(true)
__global y f32
__global ()
__global (
spam string
foo = int(5)
Expand Down

0 comments on commit f0e4438

Please sign in to comment.