Skip to content

Commit b47d35a

Browse files
committed
ci: compile golang_builder.v without warnings (fix v -prod build-tools)
1 parent 2bcbd0b commit b47d35a

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

vlib/v/gen/golang/golang.v

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ pub fn (mut f Gen) interface_decl(node ast.InterfaceDecl) {
11071107

11081108
pub fn (mut f Gen) interface_field(field ast.StructField) {
11091109
mut ft := f.no_cur_mod(f.table.type_to_str_using_aliases(field.typ, f.mod2alias))
1110-
end_pos := field.pos.pos + field.pos.len
1110+
// end_pos := field.pos.pos + field.pos.len
11111111
f.write('\t$field.name $ft')
11121112
f.writeln('')
11131113
f.mark_types_import_as_used(field.typ)
@@ -1278,7 +1278,7 @@ pub fn (mut f Gen) fn_type_decl(node ast.FnTypeDecl) {
12781278

12791279
pub fn (mut f Gen) sum_type_decl(node ast.SumTypeDecl) {
12801280
f.attrs(node.attrs)
1281-
start_pos := f.out.len
1281+
// start_pos := f.out.len
12821282
if node.is_pub {
12831283
f.write('pub ')
12841284
}
@@ -1339,16 +1339,16 @@ pub fn (mut f Gen) array_init(node ast.ArrayInit) {
13391339
// `[1,2,3]`
13401340
sym := f.table.sym(node.typ)
13411341
f.write('$sym.name{')
1342-
mut inc_indent := false
1342+
// mut inc_indent := false
13431343
mut last_line_nr := node.pos.line_nr // to have the same newlines between array elements
13441344
if node.pre_cmnts.len > 0 {
13451345
if node.pre_cmnts[0].pos.line_nr > last_line_nr {
13461346
f.writeln('')
13471347
}
13481348
}
1349-
mut set_comma := false
1350-
for i, expr in node.exprs {
1351-
pos := expr.pos()
1349+
// mut set_comma := false
1350+
for expr in node.exprs {
1351+
// pos := expr.pos()
13521352
f.expr(expr)
13531353
f.write(',')
13541354
}
@@ -1395,8 +1395,7 @@ pub fn (mut f Gen) at_expr(node ast.AtExpr) {
13951395
}
13961396

13971397
pub fn (mut f Gen) call_expr(node ast.CallExpr) {
1398-
for arg in node.args {
1399-
}
1398+
// for arg in node.args {}
14001399
mut is_method_newline := false
14011400
if node.is_method {
14021401
if node.name in ['map', 'filter', 'all', 'any'] {
@@ -1598,10 +1597,10 @@ pub fn (mut f Gen) ident(node ast.Ident) {
15981597
} else if node.kind == .blank_ident {
15991598
f.write('_')
16001599
} else {
1601-
mut is_local := false
1600+
// mut is_local := false
16021601
if !isnil(f.fn_scope) {
16031602
if _ := f.fn_scope.find_var(node.name) {
1604-
is_local = true
1603+
// is_local = true
16051604
}
16061605
}
16071606
name := f.short_module(node.name)
@@ -1616,8 +1615,8 @@ pub fn (mut f Gen) if_expr(node ast.IfExpr) {
16161615
&& branch_is_single_line(node.branches[0]) && branch_is_single_line(node.branches[1])
16171616
&& (node.is_expr || f.is_assign || f.is_struct_init || f.single_line_fields)
16181617
f.single_line_if = is_ternary
1619-
start_pos := f.out.len
1620-
start_len := f.line_len
1618+
// start_pos := f.out.len
1619+
// start_len := f.line_len
16211620
for {
16221621
for i, branch in node.branches {
16231622
if i == 0 {
@@ -1706,8 +1705,8 @@ pub fn (mut f Gen) infix_expr(node ast.InfixExpr) {
17061705
if node.op == .left_shift {
17071706
f.is_assign = true // To write ternary if on a single line
17081707
}
1709-
start_pos := f.out.len
1710-
start_len := f.line_len
1708+
// start_pos := f.out.len
1709+
// start_len := f.line_len
17111710
f.expr(node.left)
17121711
is_one_val_array_init := node.op in [.key_in, .not_in] && node.right is ast.ArrayInit
17131712
&& (node.right as ast.ArrayInit).exprs.len == 1
@@ -1792,8 +1791,8 @@ fn (mut f Gen) write_splitted_infix(conditions []string, penalties []int, ignore
17921791
}
17931792
for i, cnd in conditions {
17941793
c := cnd.trim_space()
1795-
is_paren_expr := (c[0] == `(` || (c.len > 5 && c[3] == `(`)) && c.ends_with(')')
1796-
final_len := ((f.indent + 1) * 4) + c.len
1794+
// is_paren_expr := (c[0] == `(` || (c.len > 5 && c[3] == `(`)) && c.ends_with(')')
1795+
// final_len := ((f.indent + 1) * 4) + c.len
17971796
if i == 0 {
17981797
f.remove_new_line()
17991798
}
@@ -1997,8 +1996,8 @@ pub fn (mut f Gen) or_expr(node ast.OrExpr) {
19971996
} else if node.stmts.len == 1 && stmt_is_single_line(node.stmts[0]) {
19981997
// the control stmts (return/break/continue...) print a newline inside them,
19991998
// so, since this'll all be on one line, trim any possible whitespace
2000-
str := f.node_str(node.stmts[0]).trim_space()
2001-
single_line := ' or { $str }'
1999+
// str := f.node_str(node.stmts[0]).trim_space()
2000+
// single_line := ' or { $str }'
20022001
}
20032002
// Make it multiline if the blocks has at least two stmts
20042003
// or a single line would be too long

vlib/v/gen/golang/struct.v

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ pub fn (mut f Gen) struct_decl(node ast.StructDecl) {
2727
return
2828
}
2929
mut field_types := []string{cap: node.fields.len}
30-
for i, field in node.fields {
30+
for field in node.fields {
3131
ft := f.no_cur_mod(f.table.type_to_str_using_aliases(field.typ, f.mod2alias))
3232
field_types << ft
33-
attrs_len := inline_attrs_len(field.attrs)
34-
end_pos := field.pos.pos + field.pos.len
35-
mut comments_len := 0 // Length of comments between field name and type
33+
// attrs_len := inline_attrs_len(field.attrs)
34+
// end_pos := field.pos.pos + field.pos.len
35+
// mut comments_len := 0 // Length of comments between field name and type
3636
// field_aligns.add_info(comments_len + field.name.len, ft.len, field.pos.line_nr)
3737
if field.has_default_expr {
3838
// default_expr_aligns.add_info(attrs_len, field_types[i].len, field.pos.line_nr,
@@ -45,9 +45,9 @@ pub fn (mut f Gen) struct_decl(node ast.StructDecl) {
4545
styp := f.table.type_to_str_using_aliases(embed.typ, f.mod2alias)
4646
f.writeln('\t$styp')
4747
}
48-
mut field_align_i := 0
49-
mut comment_align_i := 0
50-
mut default_expr_align_i := 0
48+
// mut field_align_i := 0
49+
// mut comment_align_i := 0
50+
// mut default_expr_align_i := 0
5151
mut inc_indent := false // for correct indents with multi line default exprs
5252
for i, field in node.fields {
5353
if i == node.mut_pos {
@@ -72,10 +72,10 @@ pub fn (mut f Gen) struct_decl(node ast.StructDecl) {
7272
f.writeln('')
7373
}
7474
}
75-
end_pos := field.pos.pos + field.pos.len
75+
// end_pos := field.pos.pos + field.pos.len
7676
volatile_prefix := if field.is_volatile { 'volatile ' } else { '' }
7777
f.write('\t$volatile_prefix$field.name ')
78-
before_len := f.line_len
78+
// before_len := f.line_len
7979
// mut field_align := field_aligns[field_align_i]
8080
// if field_align.line_nr < field.pos.line_nr {
8181
// field_align_i++
@@ -84,7 +84,7 @@ pub fn (mut f Gen) struct_decl(node ast.StructDecl) {
8484
// f.write(strings.repeat(` `, field_align.max_len - field.name.len - comments_len))
8585
f.write(field_types[i])
8686
f.mark_types_import_as_used(field.typ)
87-
attrs_len := inline_attrs_len(field.attrs)
87+
// attrs_len := inline_attrs_len(field.attrs)
8888
has_attrs := field.attrs.len > 0
8989
if has_attrs {
9090
// f.write(strings.repeat(` `, field_align.max_type_len - field_types[i].len))
@@ -163,7 +163,7 @@ pub fn (mut f Gen) struct_init(node ast.StructInit) {
163163
f.write(' ')
164164
}
165165
}
166-
fields_start := f.out.len
166+
// fields_start := f.out.len
167167
fields_loop: for {
168168
if !single_line_fields {
169169
if use_short_args && f.out[f.out.len - 1] == ` ` {

0 commit comments

Comments
 (0)