fmt: put the opening brace on a new line again for infix (#8336)
parent
3790bd67e3
commit
2007dbc7b5
|
@ -1537,7 +1537,8 @@ pub fn (mut c Checker) call_method(mut call_expr ast.CallExpr) table.Type {
|
|||
}
|
||||
if call_expr.generic_types.len > 0 && method.return_type != 0 {
|
||||
if typ := c.resolve_generic_type(method.return_type, method.generic_names,
|
||||
call_expr.generic_types) {
|
||||
call_expr.generic_types)
|
||||
{
|
||||
call_expr.return_type = typ
|
||||
return typ
|
||||
}
|
||||
|
|
|
@ -1564,8 +1564,17 @@ pub fn (mut f Fmt) if_expr(it ast.IfExpr) {
|
|||
}
|
||||
if i < it.branches.len - 1 || !it.has_else {
|
||||
f.write('${dollar}if ')
|
||||
cur_pos := f.out.len
|
||||
f.expr(branch.cond)
|
||||
f.write(' ')
|
||||
cond_len := f.out.len - cur_pos
|
||||
is_cond_wrapped := cond_len > 0
|
||||
&& (branch.cond is ast.IfGuardExpr || branch.cond is ast.CallExpr)
|
||||
&& '\n' in f.out.last_n(cond_len)
|
||||
if is_cond_wrapped {
|
||||
f.writeln('')
|
||||
} else {
|
||||
f.write(' ')
|
||||
}
|
||||
}
|
||||
f.write('{')
|
||||
if single_line {
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
fn get_typ() Type {
|
||||
{
|
||||
{
|
||||
// The opening brace should be put on a new line here for readability
|
||||
if typ := c.resolve_generic_type(method.return_type, method.generic_names,
|
||||
call_expr.generic_types)
|
||||
{
|
||||
return typ
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
fn get_typ() Type {
|
||||
{
|
||||
{
|
||||
// The opening brace should be put on a new line here for readability
|
||||
if typ := c.resolve_generic_type(method.return_type, method.generic_names, call_expr.generic_types) {
|
||||
return typ
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue