v2 / vlib / builtin / meta_struct.v
27 lines · 22 sloc · 982 bytes · 90fa8bc56fd4c3870a9041e39fc156bfacdcd1b1
Raw
1module builtin
2
3// FieldData holds information about a field. Fields reside on structs.
4pub struct FieldData {
5pub:
6 name string // the name of the field f
7 typ int // the internal TypeID of the field f,
8 unaliased_typ int // if f's type was an alias of int, this will be TypeID(int)
9
10 attrs []string // the attributes of the field f
11 is_pub bool // f is in a `pub:` section
12 is_mut bool // f is in a `mut:` section
13 is_embed bool // f is a embedded struct
14
15 is_shared bool // `f shared Abc`
16 is_atomic bool // `f atomic int` , TODO
17 is_option bool // `f ?string` , TODO
18
19 is_array bool // `f []string` , TODO
20 is_map bool // `f map[string]int` , TODO
21 is_chan bool // `f chan int` , TODO
22 is_enum bool // `f Enum` where Enum is an enum
23 is_struct bool // `f Abc` where Abc is a struct , TODO
24 is_alias bool // `f MyInt` where `type MyInt = int`, TODO
25
26 indirections u8 // 0 for `f int`, 1 for `f &int`, 2 for `f &&int` , TODO
27}
28