OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [DartPackage="_mojo_for_test_only"] | 5 [DartPackage="_mojo_for_test_only"] |
6 module mojo.test; | 6 module mojo.test; |
7 | 7 |
8 import "test_included_unions.mojom"; | 8 import "test_included_unions.mojom"; |
9 | 9 |
10 enum AnEnum { | 10 enum AnEnum { |
11 FIRST, SECOND | 11 FIRST, |
| 12 SECOND, |
12 }; | 13 }; |
13 | 14 |
| 15 // no-format |
14 union PodUnion { | 16 union PodUnion { |
15 int8 f_int8; | 17 int8 f_int8; |
16 int8 f_int8_other; | 18 int8 f_int8_other; |
17 uint8 f_uint8; | 19 uint8 f_uint8; |
18 int16 f_int16; | 20 int16 f_int16; |
19 uint16 f_uint16; | 21 uint16 f_uint16; |
20 int32 f_int32; | 22 int32 f_int32; |
21 uint32 f_uint32; | 23 uint32 f_uint32; |
22 int64 f_int64; | 24 int64 f_int64; |
23 uint64 f_uint64; | 25 uint64 f_uint64; |
24 float f_float; | 26 float f_float; |
25 double f_double; | 27 double f_double; |
26 bool f_bool; | 28 bool f_bool; |
27 AnEnum f_enum; | 29 AnEnum f_enum; |
28 }; | 30 }; |
| 31 // end-no-format |
29 | 32 |
30 // Tests that you can reference yet-to-be-declared unions in a union. | 33 // Tests that you can reference yet-to-be-declared unions in a union. |
31 union UnionOfUnions { | 34 union UnionOfUnions { |
32 ObjectUnion u; | 35 ObjectUnion u; |
33 array<ObjectUnion> a_ou; | 36 array<ObjectUnion> a_ou; |
34 array<HandleUnion> a_hu; | 37 array<HandleUnion> a_hu; |
35 map<int64, ObjectUnion> m_ou; | 38 map<int64, ObjectUnion> m_ou; |
36 map<int64, HandleUnion> m_hu; | 39 map<int64, HandleUnion> m_hu; |
37 }; | 40 }; |
38 | 41 |
39 // Tests that you can reference yet-to-be-declared unions in a struct. | 42 // Tests that you can reference yet-to-be-declared unions in a struct. |
40 struct StructOfUnions { | 43 struct StructOfUnions { |
41 ObjectUnion u; | 44 ObjectUnion u; |
42 array<ObjectUnion> a_ou; | 45 array<ObjectUnion> a_ou; |
43 array<HandleUnion> a_hu; | 46 array<HandleUnion> a_hu; |
44 map<int64, ObjectUnion> m_ou; | 47 map<int64, ObjectUnion> m_ou; |
45 map<int64, HandleUnion> m_hu; | 48 map<int64, HandleUnion> m_hu; |
46 }; | 49 }; |
47 | 50 |
48 union ObjectUnion { | 51 union ObjectUnion { |
49 int8 f_int8; | 52 int8 f_int8; |
50 string f_string; | 53 string f_string; |
51 DummyStruct f_dummy; | 54 DummyStruct f_dummy; |
52 DummyStruct? f_nullable; | 55 DummyStruct? f_nullable; |
53 array<int8> f_array_int8; | 56 array<int8> f_array_int8; |
54 map<string, int8> f_map_int8; | 57 map<string, int8> f_map_int8; |
55 PodUnion f_pod_union; | 58 PodUnion f_pod_union; |
56 }; | 59 }; |
57 | 60 |
58 union HandleUnion { | 61 union HandleUnion { |
59 handle f_handle; | 62 handle f_handle; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 }; | 123 }; |
121 | 124 |
122 union NewUnion { | 125 union NewUnion { |
123 int8 f_int8; | 126 int8 f_int8; |
124 int16 f_int16; | 127 int16 f_int16; |
125 }; | 128 }; |
126 | 129 |
127 struct IncludingStruct { | 130 struct IncludingStruct { |
128 IncludedUnion a; | 131 IncludedUnion a; |
129 }; | 132 }; |
OLD | NEW |