| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 [DartPackage="_mojo_for_test_only"] | |
| 6 module mojo.test; | |
| 7 | |
| 8 import "test_included_unions.mojom"; | |
| 9 | |
| 10 enum AnEnum { | |
| 11 FIRST, | |
| 12 SECOND, | |
| 13 }; | |
| 14 | |
| 15 union PodUnion { | |
| 16 int8 f_int8; | |
| 17 int8 f_int8_other; | |
| 18 uint8 f_uint8; | |
| 19 int16 f_int16; | |
| 20 uint16 f_uint16; | |
| 21 int32 f_int32; | |
| 22 uint32 f_uint32; | |
| 23 int64 f_int64; | |
| 24 uint64 f_uint64; | |
| 25 float f_float; | |
| 26 double f_double; | |
| 27 bool f_bool; | |
| 28 AnEnum f_enum; | |
| 29 }; | |
| 30 | |
| 31 // Tests that you can reference yet-to-be-declared unions in a union. | |
| 32 union UnionOfUnions { | |
| 33 ObjectUnion u; | |
| 34 array<ObjectUnion> a_ou; | |
| 35 array<HandleUnion> a_hu; | |
| 36 map<int64, ObjectUnion> m_ou; | |
| 37 map<int64, HandleUnion> m_hu; | |
| 38 }; | |
| 39 | |
| 40 // Tests that you can reference yet-to-be-declared unions in a struct. | |
| 41 struct StructOfUnions { | |
| 42 ObjectUnion u; | |
| 43 array<ObjectUnion> a_ou; | |
| 44 array<HandleUnion> a_hu; | |
| 45 map<int64, ObjectUnion> m_ou; | |
| 46 map<int64, HandleUnion> m_hu; | |
| 47 }; | |
| 48 | |
| 49 union UnionOfReferences { | |
| 50 PodUnion? pod_union; | |
| 51 DummyStruct? dummy_struct; | |
| 52 array<int32> int_array; | |
| 53 }; | |
| 54 | |
| 55 struct StructOfUnionOfReferences { | |
| 56 UnionOfReferences? u; | |
| 57 }; | |
| 58 | |
| 59 union ObjectUnion { | |
| 60 int8 f_int8; | |
| 61 string f_string; | |
| 62 DummyStruct f_dummy; | |
| 63 DummyStruct? f_nullable; | |
| 64 array<int8> f_array_int8; | |
| 65 map<string, int8> f_map_int8; | |
| 66 PodUnion f_pod_union; | |
| 67 }; | |
| 68 | |
| 69 union HandleUnion { | |
| 70 handle f_handle; | |
| 71 handle<message_pipe> f_message_pipe; | |
| 72 handle<data_pipe_consumer> f_data_pipe_consumer; | |
| 73 handle<data_pipe_producer> f_data_pipe_producer; | |
| 74 handle<shared_buffer> f_shared_buffer; | |
| 75 SmallCache f_small_cache; | |
| 76 }; | |
| 77 | |
| 78 struct WrapperStruct { | |
| 79 ObjectUnion? object_union; | |
| 80 PodUnion? pod_union; | |
| 81 HandleUnion? handle_union; | |
| 82 }; | |
| 83 | |
| 84 struct DummyStruct { | |
| 85 int8 f_int8; | |
| 86 }; | |
| 87 | |
| 88 struct SmallStruct { | |
| 89 DummyStruct? dummy_struct; | |
| 90 PodUnion? pod_union; | |
| 91 array<PodUnion>? pod_union_array; | |
| 92 array<PodUnion?>? nullable_pod_union_array; | |
| 93 array<DummyStruct>? s_array; | |
| 94 map<string, PodUnion>? pod_union_map; | |
| 95 map<string, PodUnion?>? nullable_pod_union_map; | |
| 96 }; | |
| 97 | |
| 98 struct SmallStructNonNullableUnion { | |
| 99 PodUnion pod_union; | |
| 100 }; | |
| 101 | |
| 102 union ObjectOnlyUnion { | |
| 103 DummyStruct dummy1; | |
| 104 }; | |
| 105 | |
| 106 struct StructNullObjectUnion { | |
| 107 ObjectOnlyUnion? obj_union; | |
| 108 }; | |
| 109 | |
| 110 struct SmallObjStruct { | |
| 111 ObjectUnion obj_union; | |
| 112 int8 f_int8; | |
| 113 }; | |
| 114 | |
| 115 interface SmallCache { | |
| 116 SetIntValue(int64 int_value); | |
| 117 GetIntValue() => (int64 int_value); | |
| 118 }; | |
| 119 | |
| 120 interface UnionInterface { | |
| 121 Echo(PodUnion in_val) => (PodUnion out_val); | |
| 122 }; | |
| 123 | |
| 124 struct TryNonNullStruct { | |
| 125 DummyStruct? nullable; | |
| 126 DummyStruct non_nullable; | |
| 127 }; | |
| 128 | |
| 129 union OldUnion { | |
| 130 int8 f_int8; | |
| 131 }; | |
| 132 | |
| 133 union NewUnion { | |
| 134 int8 f_int8; | |
| 135 int16 f_int16; | |
| 136 }; | |
| 137 | |
| 138 struct IncludingStruct { | |
| 139 IncludedUnion a; | |
| 140 }; | |
| OLD | NEW |