@@ -1107,7 +1107,7 @@ pub fn (mut f Gen) interface_decl(node ast.InterfaceDecl) {
1107
1107
1108
1108
pub fn (mut f Gen) interface_field (field ast.StructField) {
1109
1109
mut ft := f.no_cur_mod (f.table.type_to_str_using_aliases (field.typ, f.mod2 alias))
1110
- end_pos := field.pos.pos + field.pos.len
1110
+ // end_pos := field.pos.pos + field.pos.len
1111
1111
f.write ('\t $field.name $ft ' )
1112
1112
f.writeln ('' )
1113
1113
f.mark_types_import_as_used (field.typ)
@@ -1278,7 +1278,7 @@ pub fn (mut f Gen) fn_type_decl(node ast.FnTypeDecl) {
1278
1278
1279
1279
pub fn (mut f Gen) sum_type_decl (node ast.SumTypeDecl) {
1280
1280
f.attrs (node.attrs)
1281
- start_pos := f.out.len
1281
+ // start_pos := f.out.len
1282
1282
if node.is_pub {
1283
1283
f.write ('pub ' )
1284
1284
}
@@ -1339,16 +1339,16 @@ pub fn (mut f Gen) array_init(node ast.ArrayInit) {
1339
1339
// `[1,2,3]`
1340
1340
sym := f.table.sym (node.typ)
1341
1341
f.write ('$sym.name {' )
1342
- mut inc_indent := false
1342
+ // mut inc_indent := false
1343
1343
mut last_line_nr := node.pos.line_nr // to have the same newlines between array elements
1344
1344
if node.pre_cmnts.len > 0 {
1345
1345
if node.pre_cmnts[0 ].pos.line_nr > last_line_nr {
1346
1346
f.writeln ('' )
1347
1347
}
1348
1348
}
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()
1352
1352
f.expr (expr)
1353
1353
f.write (',' )
1354
1354
}
@@ -1395,8 +1395,7 @@ pub fn (mut f Gen) at_expr(node ast.AtExpr) {
1395
1395
}
1396
1396
1397
1397
pub fn (mut f Gen) call_expr (node ast.CallExpr) {
1398
- for arg in node.args {
1399
- }
1398
+ // for arg in node.args {}
1400
1399
mut is_method_newline := false
1401
1400
if node.is_method {
1402
1401
if node.name in ['map' , 'filter' , 'all' , 'any' ] {
@@ -1598,10 +1597,10 @@ pub fn (mut f Gen) ident(node ast.Ident) {
1598
1597
} else if node.kind == .blank_ident {
1599
1598
f.write ('_' )
1600
1599
} else {
1601
- mut is_local := false
1600
+ // mut is_local := false
1602
1601
if ! isnil (f.fn_scope) {
1603
1602
if _ := f.fn_scope.find_var (node.name) {
1604
- is_local = true
1603
+ // is_local = true
1605
1604
}
1606
1605
}
1607
1606
name := f.short_module (node.name)
@@ -1616,8 +1615,8 @@ pub fn (mut f Gen) if_expr(node ast.IfExpr) {
1616
1615
&& branch_is_single_line (node.branches[0 ]) && branch_is_single_line (node.branches[1 ])
1617
1616
&& (node.is_expr || f.is_assign || f.is_struct_init || f.single_line_fields)
1618
1617
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
1621
1620
for {
1622
1621
for i, branch in node.branches {
1623
1622
if i == 0 {
@@ -1706,8 +1705,8 @@ pub fn (mut f Gen) infix_expr(node ast.InfixExpr) {
1706
1705
if node.op == .left_shift {
1707
1706
f.is_assign = true // To write ternary if on a single line
1708
1707
}
1709
- start_pos := f.out.len
1710
- start_len := f.line_len
1708
+ // start_pos := f.out.len
1709
+ // start_len := f.line_len
1711
1710
f.expr (node.left)
1712
1711
is_one_val_array_init := node.op in [.key_in, .not_in] && node.right is ast.ArrayInit
1713
1712
&& (node.right as ast.ArrayInit ).exprs.len == 1
@@ -1792,8 +1791,8 @@ fn (mut f Gen) write_splitted_infix(conditions []string, penalties []int, ignore
1792
1791
}
1793
1792
for i, cnd in conditions {
1794
1793
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
1797
1796
if i == 0 {
1798
1797
f.remove_new_line ()
1799
1798
}
@@ -1997,8 +1996,8 @@ pub fn (mut f Gen) or_expr(node ast.OrExpr) {
1997
1996
} else if node.stmts.len == 1 && stmt_is_single_line (node.stmts[0 ]) {
1998
1997
// the control stmts (return/break/continue...) print a newline inside them,
1999
1998
// 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 }'
2002
2001
}
2003
2002
// Make it multiline if the blocks has at least two stmts
2004
2003
// or a single line would be too long
0 commit comments