mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix auto_str for option values (#17910)
This commit is contained in:
@@ -155,7 +155,7 @@ fn (e &Encoder) encode_struct[U](val U, level int, mut wr io.Writer) ! {
|
||||
mut i := 0
|
||||
mut fields_len := 0
|
||||
$for field in U.fields {
|
||||
if val.$(field.name).str() != 'Option(error: none)' {
|
||||
if val.$(field.name).str() != 'Option(none)' {
|
||||
fields_len++
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ fn (e &Encoder) encode_struct[U](val U, level int, mut wr io.Writer) ! {
|
||||
}
|
||||
|
||||
$if field.is_option {
|
||||
is_none := value.str() == 'Option(error: none)'
|
||||
is_none := value.str() == 'Option(none)'
|
||||
|
||||
if !is_none {
|
||||
e.encode_newline(level, mut wr)!
|
||||
|
Reference in New Issue
Block a user