cgen: format the generated source code by gen_str_for_union_sum_type() (#14026)
parent
72c2dc805d
commit
c4dff0d797
|
@ -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");')
|
||||||
|
|
Loading…
Reference in New Issue