mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
9a9cfe425c
commit
6b5c746146
@ -7,7 +7,7 @@ mut:
|
||||
|
||||
fn encode_struct[U](val U) ! {
|
||||
$for field in U.fields {
|
||||
$if field.typ is $Map {
|
||||
$if field.typ is $map {
|
||||
for _, v in val.$(field.name) {
|
||||
encode_value_with_level(v)!
|
||||
}
|
||||
@ -16,10 +16,10 @@ fn encode_struct[U](val U) ! {
|
||||
}
|
||||
|
||||
fn encode_value_with_level[T](val T) ! {
|
||||
$if T is $Struct {
|
||||
$if T is $struct {
|
||||
dump(val)
|
||||
println(encode_struct(val)!)
|
||||
} $else $if T is $Map {
|
||||
} $else $if T is $map {
|
||||
dump(val)
|
||||
} $else $if T is string {
|
||||
dump(val)
|
||||
@ -28,7 +28,7 @@ fn encode_value_with_level[T](val T) ! {
|
||||
|
||||
fn (e &Encoder) encode_struct[U](val U) ! {
|
||||
$for field in U.fields {
|
||||
$if field.typ is $Map {
|
||||
$if field.typ is $map {
|
||||
for _, v in val.$(field.name) {
|
||||
e.encode_value_with_level(v)!
|
||||
}
|
||||
@ -37,10 +37,10 @@ fn (e &Encoder) encode_struct[U](val U) ! {
|
||||
}
|
||||
|
||||
fn (e &Encoder) encode_value_with_level[T](val T) ! {
|
||||
$if T is $Struct {
|
||||
$if T is $struct {
|
||||
dump(val)
|
||||
println(e.encode_struct(val)!)
|
||||
} $else $if T is $Map {
|
||||
} $else $if T is $map {
|
||||
dump(val)
|
||||
} $else $if T is string {
|
||||
dump(val)
|
||||
|
Loading…
Reference in New Issue
Block a user