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 |
14 union PodUnion { | 15 union PodUnion { |
15 int8 f_int8; | 16 int8 f_int8; |
16 int8 f_int8_other; | 17 int8 f_int8_other; |
17 uint8 f_uint8; | 18 uint8 f_uint8; |
18 int16 f_int16; | 19 int16 f_int16; |
19 uint16 f_uint16; | 20 uint16 f_uint16; |
20 int32 f_int32; | 21 int32 f_int32; |
21 uint32 f_uint32; | 22 uint32 f_uint32; |
22 int64 f_int64; | 23 int64 f_int64; |
23 uint64 f_uint64; | 24 uint64 f_uint64; |
24 float f_float; | 25 float f_float; |
25 double f_double; | 26 double f_double; |
26 bool f_bool; | 27 bool f_bool; |
27 AnEnum f_enum; | 28 AnEnum f_enum; |
28 }; | 29 }; |
29 | 30 |
30 // Tests that you can reference yet-to-be-declared unions in a union. | 31 // Tests that you can reference yet-to-be-declared unions in a union. |
31 union UnionOfUnions { | 32 union UnionOfUnions { |
32 ObjectUnion u; | 33 ObjectUnion u; |
33 array<ObjectUnion> a_ou; | 34 array<ObjectUnion> a_ou; |
34 array<HandleUnion> a_hu; | 35 array<HandleUnion> a_hu; |
35 map<int64, ObjectUnion> m_ou; | 36 map<int64, ObjectUnion> m_ou; |
36 map<int64, HandleUnion> m_hu; | 37 map<int64, HandleUnion> m_hu; |
37 }; | 38 }; |
38 | 39 |
39 // Tests that you can reference yet-to-be-declared unions in a struct. | 40 // Tests that you can reference yet-to-be-declared unions in a struct. |
40 struct StructOfUnions { | 41 struct StructOfUnions { |
41 ObjectUnion u; | 42 ObjectUnion u; |
42 array<ObjectUnion> a_ou; | 43 array<ObjectUnion> a_ou; |
43 array<HandleUnion> a_hu; | 44 array<HandleUnion> a_hu; |
44 map<int64, ObjectUnion> m_ou; | 45 map<int64, ObjectUnion> m_ou; |
45 map<int64, HandleUnion> m_hu; | 46 map<int64, HandleUnion> m_hu; |
46 }; | 47 }; |
47 | 48 |
48 union ObjectUnion { | 49 union ObjectUnion { |
49 int8 f_int8; | 50 int8 f_int8; |
50 string f_string; | 51 string f_string; |
51 DummyStruct f_dummy; | 52 DummyStruct f_dummy; |
52 DummyStruct? f_nullable; | 53 DummyStruct? f_nullable; |
53 array<int8> f_array_int8; | 54 array<int8> f_array_int8; |
54 map<string, int8> f_map_int8; | 55 map<string, int8> f_map_int8; |
55 PodUnion f_pod_union; | 56 PodUnion f_pod_union; |
56 }; | 57 }; |
57 | 58 |
58 union HandleUnion { | 59 union HandleUnion { |
59 handle f_handle; | 60 handle f_handle; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 }; | 121 }; |
121 | 122 |
122 union NewUnion { | 123 union NewUnion { |
123 int8 f_int8; | 124 int8 f_int8; |
124 int16 f_int16; | 125 int16 f_int16; |
125 }; | 126 }; |
126 | 127 |
127 struct IncludingStruct { | 128 struct IncludingStruct { |
128 IncludedUnion a; | 129 IncludedUnion a; |
129 }; | 130 }; |
OLD | NEW |