mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: minor cleanup in gen_str_for_option (#8622)
This commit is contained in:
parent
9e751f72c4
commit
f2100166c7
@ -138,7 +138,7 @@ fn (mut g Gen) gen_str_for_option(typ table.Type, styp string, str_fn_name strin
|
|||||||
g.auto_str_funcs.writeln('\tif (it.is_none) {')
|
g.auto_str_funcs.writeln('\tif (it.is_none) {')
|
||||||
g.auto_str_funcs.writeln('\t\tres = _SLIT("none");')
|
g.auto_str_funcs.writeln('\t\tres = _SLIT("none");')
|
||||||
g.auto_str_funcs.writeln('\t} else if (it.ok) {')
|
g.auto_str_funcs.writeln('\t} else if (it.ok) {')
|
||||||
if typ.is_string() {
|
if sym.kind == .string {
|
||||||
g.auto_str_funcs.writeln('\t\tres = _STR("\'%.*s\\000\'", 2, ${parent_str_fn_name}(*($sym.cname*)it.data));')
|
g.auto_str_funcs.writeln('\t\tres = _STR("\'%.*s\\000\'", 2, ${parent_str_fn_name}(*($sym.cname*)it.data));')
|
||||||
} else if sym.kind == .struct_ && !sym_has_str_method {
|
} else if sym.kind == .struct_ && !sym_has_str_method {
|
||||||
g.auto_str_funcs.writeln('\t\tres = indent_${parent_str_fn_name}(*($sym.cname*)it.data, indent_count);')
|
g.auto_str_funcs.writeln('\t\tres = indent_${parent_str_fn_name}(*($sym.cname*)it.data, indent_count);')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user