mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: format the generated source code by gen_str_for_union_sum_type() (#14026)
This commit is contained in:
@@ -472,7 +472,7 @@ fn (mut g Gen) gen_str_for_union_sum_type(info ast.SumType, styp string, str_fn_
|
|||||||
{_SLIT("${clean_sum_type_v_type_name}(\'"), $c.si_s_code, {.d_s = $val}},
|
{_SLIT("${clean_sum_type_v_type_name}(\'"), $c.si_s_code, {.d_s = $val}},
|
||||||
{_SLIT("\')"), 0, {.d_c = 0 }}
|
{_SLIT("\')"), 0, {.d_c = 0 }}
|
||||||
}))'
|
}))'
|
||||||
fn_builder.write_string('\t\tcase $typ.idx(): return $res;')
|
fn_builder.write_string('\t\tcase $typ.idx(): return $res;\n')
|
||||||
} else {
|
} else {
|
||||||
mut val := '${func_name}(${deref}($typ_str*)x._$sym.cname'
|
mut val := '${func_name}(${deref}($typ_str*)x._$sym.cname'
|
||||||
if should_use_indent_func(sym.kind) && !sym_has_str_method {
|
if should_use_indent_func(sym.kind) && !sym_has_str_method {
|
||||||
@@ -483,7 +483,7 @@ fn (mut g Gen) gen_str_for_union_sum_type(info ast.SumType, styp string, str_fn_
|
|||||||
{_SLIT("${clean_sum_type_v_type_name}("), $c.si_s_code, {.d_s = $val}},
|
{_SLIT("${clean_sum_type_v_type_name}("), $c.si_s_code, {.d_s = $val}},
|
||||||
{_SLIT(")"), 0, {.d_c = 0 }}
|
{_SLIT(")"), 0, {.d_c = 0 }}
|
||||||
}))'
|
}))'
|
||||||
fn_builder.write_string('\t\tcase $typ.idx(): return $res;')
|
fn_builder.write_string('\t\tcase $typ.idx(): return $res;\n')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn_builder.writeln('\t\tdefault: return _SLIT("unknown sum type value");')
|
fn_builder.writeln('\t\tdefault: return _SLIT("unknown sum type value");')
|
||||||
|
Reference in New Issue
Block a user