v2 / vlib / v / fmt / tests / structs_comments_keep.vv
59 lines · 52 sloc · 758 bytes · acf6b344f733169ec6ecc9881f8a8c2c795b9883
Raw
1struct User {
2 name string // name
3 name2 []rune // name2
4 very_long_field bool
5 age int // age
6 very_long_type_field1 very_looooog_type // long
7 very_long_type_field2 very_loooooooong_type // long
8}
9
10struct FamousUser {
11 User
12pub:
13 aka string
14}
15
16struct Foo {
17 field1 int // f1
18 field2 string // f2
19pub:
20 public_field1 int // f1
21 public_field2 f64 // f2
22mut:
23 mut_field string
24pub mut:
25 pub_mut_field string
26}
27
28struct Bar {
29 Foo
30}
31
32fn new_user() User {
33 return User{
34 name: 'Serious Sam'
35 age: 19
36 }
37}
38
39struct SomeStruct {
40 // 1
41mut:
42 // 2
43 // 3
44 somefield int /*
45 9
4610
47 */
48 somefield2 int // 12
49pub:
50 somefield3 int
51
52 somefield4 int
53 /*
54 13
5514
56 */
57}
58
59pub struct C.Foo {}
60