mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
26 lines
349 B
V
26 lines
349 B
V
module main
|
|
|
|
struct Aa {
|
|
sub AliasType
|
|
}
|
|
|
|
type AliasType = Bb
|
|
|
|
struct Bb {
|
|
a int
|
|
}
|
|
|
|
fn encode_struct[U](val U, mut out []string) []string {
|
|
$for field in U.fields {
|
|
encode_struct(val.$(field.name), mut out)
|
|
out << field.str()
|
|
}
|
|
return out
|
|
}
|
|
|
|
fn test_main() {
|
|
aa := Aa{}
|
|
mut out := []string{}
|
|
assert encode_struct(aa, mut out).len == 2
|
|
}
|