mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
x.json2: update tests to integrate decoder2 in json2 (#24551)
This commit is contained in:
parent
7dc3889f19
commit
cd244757db
8 changed files with 18 additions and 32 deletions
|
@ -546,6 +546,13 @@ pub fn decode[T](val string) !T {
|
|||
@[manualfree]
|
||||
fn (mut decoder Decoder) decode_value[T](mut val T) ! {
|
||||
$if T is $option {
|
||||
value_info := decoder.current_node.value
|
||||
|
||||
if value_info.value_kind == .null {
|
||||
decoder.current_node = decoder.current_node.next
|
||||
// val = none // Is this line needed?
|
||||
return
|
||||
}
|
||||
mut unwrapped_val := create_value_from_optional(val.$(field.name))
|
||||
decoder.decode_value(mut unwrapped_val)!
|
||||
val.$(field.name) = unwrapped_val
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue