1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: str:skip field

This commit is contained in:
Alexander Medvednikov 2022-07-25 17:25:37 +03:00
parent 5a3a145e99
commit f1ebfb2d42

View File

@ -846,6 +846,15 @@ fn (mut g Gen) gen_str_for_struct(info ast.Struct, styp string, str_fn_name stri
fn_body.writeln('\tstring res = str_intp( ${info.fields.len * 4 + 3}, _MOV((StrIntpData[]){')
fn_body.writeln('\t\t{_SLIT("$clean_struct_v_type_name{\\n"), 0, {.d_c=0}},')
for i, field in info.fields {
// Skip `str:skip` fields
if attr := field.attrs.find_first('str') {
if attr.arg == 'skip' {
fn_body.writeln('{_SLIT(""), 0, {.d_c=0}},')
fn_body.writeln('{_SLIT(""), 0, {.d_c=0}},')
continue
}
}
ftyp_noshared := if field.typ.has_flag(.shared_f) {
field.typ.deref().clear_flag(.shared_f)
} else {