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

cgen: fix comptimeselector option propagation (#18092)

This commit is contained in:
Felipe Pena
2023-05-03 02:31:48 -03:00
committed by GitHub
parent 458132b1b2
commit 2c123dffbb
6 changed files with 76 additions and 7 deletions

View File

@@ -210,12 +210,12 @@ fn (e &Encoder) encode_struct[U](val U, level int, mut wr io.Writer) ! {
}
$if field.typ is ?string {
e.encode_string(val.$(field.name) ?.str()#[8..-2], mut wr)!
e.encode_string(val.$(field.name) ?.str(), mut wr)!
} $else $if field.typ is ?bool || field.typ is ?f32 || field.typ is ?f64
|| field.typ is ?i8 || field.typ is ?i16 || field.typ is ?int
|| field.typ is ?i64 || field.typ is ?u8 || field.typ is ?u16
|| field.typ is ?u32 || field.typ is ?u64 {
wr.write(val.$(field.name) ?.str()#[7..-1].bytes())!
wr.write(val.$(field.name) ?.str().bytes())!
} $else $if field.typ is ?time.Time {
option_value := val.$(field.name) as ?time.Time
parsed_time := option_value as time.Time