v/vlib/v/fmt/tests/infix_expr_expected.vv

34 lines
1.1 KiB
V

fn grouped_cond_single_line() {
// fmt tries to keep grouped conditions together...
_ := one_condition_before && another_condition
&& (inside_paren || is_kept_together || if_possible) && end_cond
}
fn unwrap_grouped_conds() {
// ...but sometimes they have to be splitted
_ := one_condition && before_condition && (conds_inside_paren
|| are_kept_together || if_possible || but_this_is_really_too_much
|| for_one_line)
_ := (also_inside_parens || just_as_above || but_this_is_also_more
|| than_a_single_line_could_fit) && end_cond
fields = fields.filter((it.typ in [string_type, int_type, bool_type]
|| c.table.types[int(it.typ)].kind == .struct_) && !it.attrs.contains('skip'))
}
fn main() {
clean_struct_v_type_name =
clean_struct_v_type_name.replace('_Array', '_array').replace('_T_', '<').replace('_', ', ') +
'>'
{
{
{
// Indent this much to force a break after the assign (`:=`).
// Check that the trailing space is removed
should_cast :=
(g.table.type_kind(stmt.left_types.first()) in js.shallow_equatables)
&& (g.cast_stack.len <= 0 || stmt.left_types.first() != g.cast_stack.last())
}
}
}
}