Index: mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart |
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart |
index 1e81267310f6f66e56242e0dc4109035a0b5bb61..16fb81c7fb7162ee0e3d9eb4323e5b6b6e84f9ce 100644 |
--- a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart |
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/mojo/test/test_unions.mojom.dart |
@@ -8,7 +8,9 @@ import 'dart:async'; |
import 'package:mojo/bindings.dart' as bindings; |
import 'package:mojo/core.dart' as core; |
-import 'package:mojom/mojo/test/test_included_unions.mojom.dart' as test_included_unions_mojom; |
+import 'package:mojo/mojo/mojom_types.mojom.dart' as mojom_types; |
+import 'package:mojo/mojo/service_describer.mojom.dart' as service_describer; |
+import 'package:_mojo_for_test_only/mojo/test/test_included_unions.mojom.dart' as test_included_unions_mojom; |
class AnEnum extends bindings.MojoEnum { |
static const FIRST = const AnEnum._(0); |
static const SECOND = const AnEnum._(1); |
@@ -53,12 +55,26 @@ class AnEnum extends bindings.MojoEnum { |
return 'AnEnum.FIRST'; |
case SECOND: |
return 'AnEnum.SECOND'; |
+ default: |
+ return null; |
} |
} |
int toJson() => value; |
} |
+mojom_types.MojomEnum _test_unions_AnEnum__() { |
+ return new mojom_types.MojomEnum() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "AnEnum") |
+ ..values = <mojom_types.EnumValue>[new mojom_types.EnumValue() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "FIRST") |
+ ..enumTypeKey = '_test_unions_AnEnum__' |
+ ..intValue = 0,new mojom_types.EnumValue() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "SECOND") |
+ ..enumTypeKey = '_test_unions_AnEnum__' |
+ ..intValue = 1,]; |
+} |
+ |
class WrapperStruct extends bindings.Struct { |
@@ -142,6 +158,45 @@ class WrapperStruct extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_WrapperStruct__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'WrapperStruct') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ObjectUnion') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_ObjectUnion__' |
+ ..typeKey = '_test_unions_ObjectUnion__' |
+ )), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'PodUnion') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'HandleUnion') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_HandleUnion__' |
+ ..typeKey = '_test_unions_HandleUnion__' |
+ )), |
+ ]; |
+} |
+ |
class DummyStruct extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -209,6 +264,16 @@ class DummyStruct extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_DummyStruct__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'DummyStruct') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt8') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8), |
+ ]; |
+} |
+ |
class SmallStruct extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -506,6 +571,102 @@ class SmallStruct extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_SmallStruct__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'SmallStruct') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'DummyStruct') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_DummyStruct__' |
+ ..typeKey = '_test_unions_DummyStruct__' |
+ )), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'PodUnion') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'PodUnionArray') |
+ ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType() |
+ ..nullable = true |
+ |
+ ..elementType = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )))), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'NullablePodUnionArray') |
+ ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType() |
+ ..nullable = true |
+ |
+ ..elementType = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )))), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'SArray') |
+ ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType() |
+ ..nullable = true |
+ |
+ ..elementType = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_DummyStruct__' |
+ ..typeKey = '_test_unions_DummyStruct__' |
+ )))), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'PodUnionMap') |
+ ..type = (new mojom_types.Type()..mapType = (new mojom_types.MapType() |
+ ..nullable = true |
+ |
+ ..keyType = (new mojom_types.Type() |
+..stringType = (new mojom_types.StringType()..nullable = false)) |
+ ..valueType = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )))), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'NullablePodUnionMap') |
+ ..type = (new mojom_types.Type()..mapType = (new mojom_types.MapType() |
+ ..nullable = true |
+ |
+ ..keyType = (new mojom_types.Type() |
+..stringType = (new mojom_types.StringType()..nullable = false)) |
+ ..valueType = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )))), |
+ ]; |
+} |
+ |
class SmallStructNonNullableUnion extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -577,6 +738,21 @@ class SmallStructNonNullableUnion extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_SmallStructNonNullableUnion__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'SmallStructNonNullableUnion') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'PodUnion') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )), |
+ ]; |
+} |
+ |
class StructNullObjectUnion extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -644,6 +820,23 @@ class StructNullObjectUnion extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_StructNullObjectUnion__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'StructNullObjectUnion') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ObjUnion') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_ObjectOnlyUnion__' |
+ ..typeKey = '_test_unions_ObjectOnlyUnion__' |
+ )), |
+ ]; |
+} |
+ |
class SmallObjStruct extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -724,6 +917,25 @@ class SmallObjStruct extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_SmallObjStruct__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'SmallObjStruct') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ObjUnion') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_ObjectUnion__' |
+ ..typeKey = '_test_unions_ObjectUnion__' |
+ )), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt8') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8), |
+ ]; |
+} |
+ |
class TryNonNullStruct extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -802,6 +1014,32 @@ class TryNonNullStruct extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_TryNonNullStruct__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'TryNonNullStruct') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Nullable') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_DummyStruct__' |
+ ..typeKey = '_test_unions_DummyStruct__' |
+ )), |
+ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'NonNullable') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_DummyStruct__' |
+ ..typeKey = '_test_unions_DummyStruct__' |
+ )), |
+ ]; |
+} |
+ |
class IncludingStruct extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -873,6 +1111,21 @@ class IncludingStruct extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_IncludingStruct__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'IncludingStruct') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'A') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_included_unions_IncludedUnion__' |
+ ..typeKey = '_test_included_unions_IncludedUnion__' |
+ )), |
+ ]; |
+} |
+ |
class SmallCacheSetIntValueParams extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -940,6 +1193,16 @@ class SmallCacheSetIntValueParams extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_SmallCache_SetIntValue_Params__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'SmallCacheSetIntValueParams') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'IntValue') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT64), |
+ ]; |
+} |
+ |
class SmallCacheGetIntValueParams extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -998,6 +1261,12 @@ class SmallCacheGetIntValueParams extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_SmallCache_GetIntValue_Params__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'SmallCacheGetIntValueParams') |
+ ..fields = <mojom_types.StructField>[]; |
+} |
+ |
class SmallCacheGetIntValueResponseParams extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -1065,6 +1334,16 @@ class SmallCacheGetIntValueResponseParams extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_SmallCache_GetIntValue_ResponseParams__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'SmallCacheGetIntValueResponseParams') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'IntValue') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT64), |
+ ]; |
+} |
+ |
class UnionInterfaceEchoParams extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -1136,6 +1415,21 @@ class UnionInterfaceEchoParams extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_UnionInterface_Echo_Params__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'UnionInterfaceEchoParams') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'InVal') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )), |
+ ]; |
+} |
+ |
class UnionInterfaceEchoResponseParams extends bindings.Struct { |
static const List<bindings.StructDataHeader> kVersions = const [ |
@@ -1207,6 +1501,21 @@ class UnionInterfaceEchoResponseParams extends bindings.Struct { |
} |
} |
+mojom_types.MojomStruct _test_unions_UnionInterface_Echo_ResponseParams__() { |
+ return new mojom_types.MojomStruct() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'UnionInterfaceEchoResponseParams') |
+ ..fields = <mojom_types.StructField>[ |
+ new mojom_types.StructField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'OutVal') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )), |
+ ]; |
+} |
+ |
enum PodUnionTag { |
@@ -1414,7 +1723,7 @@ class PodUnion extends bindings.Union { |
} |
PodUnion result = new PodUnion(); |
- // TODO(azani): Handle unknown union member. |
+ // TODO(azani): Handle unknown union member. An assert breaks validation_unittest. |
PodUnionTag tag = _int_to_tag[decoder0.decodeUint32(offset + 4)]; |
switch (tag) { |
case PodUnionTag.fInt8: |
@@ -1473,6 +1782,8 @@ class PodUnion extends bindings.Union { |
'Trying to decode null union for non-nullable AnEnum.'); |
} |
break; |
+ default: |
+ break; |
} |
return result; |
@@ -1535,6 +1846,8 @@ class PodUnion extends bindings.Union { |
encoder0.encodeEnum(fEnum, offset + 8); |
break; |
+ default: |
+ break; |
} |
} |
@@ -1588,6 +1901,82 @@ class PodUnion extends bindings.Union { |
} |
} |
+mojom_types.MojomUnion _test_unions_PodUnion__() { |
+ return new mojom_types.MojomUnion() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'PodUnion') |
+ ..fields = <mojom_types.UnionField>[ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt8') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8) |
+ ..tag = 0, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt8Other') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8) |
+ ..tag = 1, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FUint8') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.UINT8) |
+ ..tag = 2, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt16') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT16) |
+ ..tag = 3, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FUint16') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.UINT16) |
+ ..tag = 4, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt32') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT32) |
+ ..tag = 5, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FUint32') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.UINT32) |
+ ..tag = 6, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt64') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT64) |
+ ..tag = 7, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FUint64') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.UINT64) |
+ ..tag = 8, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FFloat') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.FLOAT) |
+ ..tag = 9, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FDouble') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.DOUBLE) |
+ ..tag = 10, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FBool') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.BOOL) |
+ ..tag = 11, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FEnum') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_AnEnum__' |
+ ..typeKey = '_test_unions_AnEnum__' |
+ )) |
+ ..tag = 12, |
+ ]; |
+} |
+ |
enum ObjectUnionTag { |
fInt8, |
@@ -1710,7 +2099,7 @@ class ObjectUnion extends bindings.Union { |
} |
ObjectUnion result = new ObjectUnion(); |
- // TODO(azani): Handle unknown union member. |
+ // TODO(azani): Handle unknown union member. An assert breaks validation_unittest. |
ObjectUnionTag tag = _int_to_tag[decoder0.decodeUint32(offset + 4)]; |
switch (tag) { |
case ObjectUnionTag.fInt8: |
@@ -1766,6 +2155,8 @@ class ObjectUnion extends bindings.Union { |
var decoder1 = decoder0.decodePointer(offset + 8, false); |
result.fPodUnion = PodUnion.decode(decoder1, 0); |
break; |
+ default: |
+ break; |
} |
return result; |
@@ -1820,6 +2211,8 @@ class ObjectUnion extends bindings.Union { |
case ObjectUnionTag.fPodUnion: |
encoder0.encodeNestedUnion(fPodUnion, offset + 8, false); |
break; |
+ default: |
+ break; |
} |
} |
@@ -1855,6 +2248,69 @@ class ObjectUnion extends bindings.Union { |
} |
} |
+mojom_types.MojomUnion _test_unions_ObjectUnion__() { |
+ return new mojom_types.MojomUnion() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ObjectUnion') |
+ ..fields = <mojom_types.UnionField>[ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt8') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8) |
+ ..tag = 0, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FString') |
+ ..type = (new mojom_types.Type() |
+..stringType = (new mojom_types.StringType()..nullable = false)) |
+ ..tag = 1, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FDummy') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_DummyStruct__' |
+ ..typeKey = '_test_unions_DummyStruct__' |
+ )) |
+ ..tag = 2, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FNullable') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ ..nullable = true |
+ |
+ |
+ ..identifier = '_test_unions_DummyStruct__' |
+ ..typeKey = '_test_unions_DummyStruct__' |
+ )) |
+ ..tag = 3, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FArrayInt8') |
+ ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType() |
+ ..elementType = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8))) |
+ ..tag = 4, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FMapInt8') |
+ ..type = (new mojom_types.Type()..mapType = (new mojom_types.MapType() |
+ ..keyType = (new mojom_types.Type() |
+..stringType = (new mojom_types.StringType()..nullable = false)) |
+ ..valueType = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8))) |
+ ..tag = 5, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FPodUnion') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_PodUnion__' |
+ ..typeKey = '_test_unions_PodUnion__' |
+ )) |
+ ..tag = 6, |
+ ]; |
+} |
+ |
enum HandleUnionTag { |
fHandle, |
@@ -1963,7 +2419,7 @@ class HandleUnion extends bindings.Union { |
} |
HandleUnion result = new HandleUnion(); |
- // TODO(azani): Handle unknown union member. |
+ // TODO(azani): Handle unknown union member. An assert breaks validation_unittest. |
HandleUnionTag tag = _int_to_tag[decoder0.decodeUint32(offset + 4)]; |
switch (tag) { |
case HandleUnionTag.fHandle: |
@@ -1990,6 +2446,8 @@ class HandleUnion extends bindings.Union { |
result.fSmallCache = decoder0.decodeServiceInterface(offset + 8, false, SmallCacheProxy.newFromEndpoint); |
break; |
+ default: |
+ break; |
} |
return result; |
@@ -2024,6 +2482,8 @@ class HandleUnion extends bindings.Union { |
encoder0.encodeInterface(fSmallCache, offset + 8, false); |
break; |
+ default: |
+ break; |
} |
} |
@@ -2056,6 +2516,62 @@ class HandleUnion extends bindings.Union { |
} |
} |
+mojom_types.MojomUnion _test_unions_HandleUnion__() { |
+ return new mojom_types.MojomUnion() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'HandleUnion') |
+ ..fields = <mojom_types.UnionField>[ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FHandle') |
+ ..type = (new mojom_types.Type() |
+..handleType = (new mojom_types.HandleType() |
+..kind = mojom_types.HandleTypeKind.UNSPECIFIED |
+..nullable = false)) |
+ ..tag = 0, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FMessagePipe') |
+ ..type = (new mojom_types.Type() |
+..handleType = (new mojom_types.HandleType() |
+..kind = mojom_types.HandleTypeKind.MESSAGE_PIPE |
+..nullable = false)) |
+ ..tag = 1, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FDataPipeConsumer') |
+ ..type = (new mojom_types.Type() |
+..handleType = (new mojom_types.HandleType() |
+..kind = mojom_types.HandleTypeKind.DATA_PIPE_CONSUMER |
+..nullable = false)) |
+ ..tag = 2, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FDataPipeProducer') |
+ ..type = (new mojom_types.Type() |
+..handleType = (new mojom_types.HandleType() |
+..kind = mojom_types.HandleTypeKind.DATA_PIPE_PRODUCER |
+..nullable = false)) |
+ ..tag = 3, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FSharedBuffer') |
+ ..type = (new mojom_types.Type() |
+..handleType = (new mojom_types.HandleType() |
+..kind = mojom_types.HandleTypeKind.SHARED_BUFFER |
+..nullable = false)) |
+ ..tag = 4, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FSmallCache') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_SmallCache__' |
+ ..typeKey = '_test_unions_SmallCache__' |
+ )) |
+ ..tag = 5, |
+ ]; |
+} |
+ |
enum ObjectOnlyUnionTag { |
dummy1, |
@@ -2094,7 +2610,7 @@ class ObjectOnlyUnion extends bindings.Union { |
} |
ObjectOnlyUnion result = new ObjectOnlyUnion(); |
- // TODO(azani): Handle unknown union member. |
+ // TODO(azani): Handle unknown union member. An assert breaks validation_unittest. |
ObjectOnlyUnionTag tag = _int_to_tag[decoder0.decodeUint32(offset + 4)]; |
switch (tag) { |
case ObjectOnlyUnionTag.dummy1: |
@@ -2102,6 +2618,8 @@ class ObjectOnlyUnion extends bindings.Union { |
var decoder1 = decoder0.decodePointer(offset + 8, false); |
result.dummy1 = DummyStruct.decode(decoder1); |
break; |
+ default: |
+ break; |
} |
return result; |
@@ -2116,6 +2634,8 @@ class ObjectOnlyUnion extends bindings.Union { |
encoder0.encodeStruct(dummy1, offset + 8, false); |
break; |
+ default: |
+ break; |
} |
} |
@@ -2133,6 +2653,22 @@ class ObjectOnlyUnion extends bindings.Union { |
} |
} |
+mojom_types.MojomUnion _test_unions_ObjectOnlyUnion__() { |
+ return new mojom_types.MojomUnion() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'ObjectOnlyUnion') |
+ ..fields = <mojom_types.UnionField>[ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Dummy1') |
+ ..type = (new mojom_types.Type() |
+ ..typeReference = (new mojom_types.TypeReference() |
+ |
+ ..identifier = '_test_unions_DummyStruct__' |
+ ..typeKey = '_test_unions_DummyStruct__' |
+ )) |
+ ..tag = 0, |
+ ]; |
+} |
+ |
enum OldUnionTag { |
fInt8, |
@@ -2171,13 +2707,15 @@ class OldUnion extends bindings.Union { |
} |
OldUnion result = new OldUnion(); |
- // TODO(azani): Handle unknown union member. |
+ // TODO(azani): Handle unknown union member. An assert breaks validation_unittest. |
OldUnionTag tag = _int_to_tag[decoder0.decodeUint32(offset + 4)]; |
switch (tag) { |
case OldUnionTag.fInt8: |
result.fInt8 = decoder0.decodeInt8(offset + 8); |
break; |
+ default: |
+ break; |
} |
return result; |
@@ -2192,6 +2730,8 @@ class OldUnion extends bindings.Union { |
encoder0.encodeInt8(fInt8, offset + 8); |
break; |
+ default: |
+ break; |
} |
} |
@@ -2209,6 +2749,17 @@ class OldUnion extends bindings.Union { |
} |
} |
+mojom_types.MojomUnion _test_unions_OldUnion__() { |
+ return new mojom_types.MojomUnion() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'OldUnion') |
+ ..fields = <mojom_types.UnionField>[ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt8') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8) |
+ ..tag = 0, |
+ ]; |
+} |
+ |
enum NewUnionTag { |
fInt8, |
@@ -2261,7 +2812,7 @@ class NewUnion extends bindings.Union { |
} |
NewUnion result = new NewUnion(); |
- // TODO(azani): Handle unknown union member. |
+ // TODO(azani): Handle unknown union member. An assert breaks validation_unittest. |
NewUnionTag tag = _int_to_tag[decoder0.decodeUint32(offset + 4)]; |
switch (tag) { |
case NewUnionTag.fInt8: |
@@ -2272,6 +2823,8 @@ class NewUnion extends bindings.Union { |
result.fInt16 = decoder0.decodeInt16(offset + 8); |
break; |
+ default: |
+ break; |
} |
return result; |
@@ -2290,6 +2843,8 @@ class NewUnion extends bindings.Union { |
encoder0.encodeInt16(fInt16, offset + 8); |
break; |
+ default: |
+ break; |
} |
} |
@@ -2309,12 +2864,57 @@ class NewUnion extends bindings.Union { |
return result; |
} |
} |
+ |
+mojom_types.MojomUnion _test_unions_NewUnion__() { |
+ return new mojom_types.MojomUnion() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'NewUnion') |
+ ..fields = <mojom_types.UnionField>[ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt8') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT8) |
+ ..tag = 0, |
+ |
+ new mojom_types.UnionField() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FInt16') |
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.INT16) |
+ ..tag = 1, |
+ ]; |
+} |
+ |
const int kSmallCache_setIntValue_name = 0; |
const int kSmallCache_getIntValue_name = 1; |
const String SmallCacheName = |
'mojo::test::SmallCache'; |
+mojom_types.MojomInterface _test_unions_SmallCache__() { |
+ return new mojom_types.MojomInterface() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "SmallCache") |
+ ..interfaceName = "SmallCache" |
+ ..methods = <int, mojom_types.MojomMethod>{ |
+kSmallCache_setIntValue_name: new mojom_types.MojomMethod() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "SetIntValue") |
+ ..ordinal = kSmallCache_setIntValue_name..parameters = _test_unions_SmallCache_SetIntValue_Params__(),kSmallCache_getIntValue_name: new mojom_types.MojomMethod() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "GetIntValue") |
+ ..ordinal = kSmallCache_getIntValue_name |
+ ..responseParams = _test_unions_SmallCache_GetIntValue_ResponseParams__()..parameters = _test_unions_SmallCache_GetIntValue_Params__(), |
+ }; |
+} |
+ |
+class _SmallCacheServiceDescription extends service_describer.ServiceDescription { |
+ // Avoid infinite loop by overriding serviceDescription field. |
+ final service_describer.ServiceDescription serviceDescription = null; |
+dynamic getTopLevelInterface([Function responseFactory = null]) { |
+ return _test_unions_SmallCache__(); |
+ } |
+ dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
+ return getAllMojomTypeDefinitions()[typeKey]; |
+ } |
+ dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
+ return getAllMojomTypeDefinitions(); |
+ } |
+} |
+ |
abstract class SmallCache { |
void setIntValue(int intValue); |
dynamic getIntValue([Function responseFactory = null]); |
@@ -2339,6 +2939,9 @@ class SmallCacheProxyImpl extends bindings.Proxy { |
String get name => SmallCacheName; |
+ service_describer.ServiceDescription get serviceDescription => |
+ new _SmallCacheServiceDescription(); |
+ |
void handleResponse(bindings.ServiceMessage message) { |
switch (message.header.type) { |
case kSmallCache_getIntValue_name: |
@@ -2539,6 +3142,9 @@ class SmallCacheStub extends bindings.Stub { |
} |
int get version => 0; |
+ |
+ service_describer.ServiceDescription get serviceDescription => |
+ new _SmallCacheServiceDescription(); |
} |
const int kUnionInterface_echo_name = 0; |
@@ -2546,6 +3152,32 @@ const int kUnionInterface_echo_name = 0; |
const String UnionInterfaceName = |
'mojo::test::UnionInterface'; |
+mojom_types.MojomInterface _test_unions_UnionInterface__() { |
+ return new mojom_types.MojomInterface() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "UnionInterface") |
+ ..interfaceName = "UnionInterface" |
+ ..methods = <int, mojom_types.MojomMethod>{ |
+kUnionInterface_echo_name: new mojom_types.MojomMethod() |
+ ..declData = (new mojom_types.DeclarationData()..shortName = "Echo") |
+ ..ordinal = kUnionInterface_echo_name |
+ ..responseParams = _test_unions_UnionInterface_Echo_ResponseParams__()..parameters = _test_unions_UnionInterface_Echo_Params__(), |
+ }; |
+} |
+ |
+class _UnionInterfaceServiceDescription extends service_describer.ServiceDescription { |
+ // Avoid infinite loop by overriding serviceDescription field. |
+ final service_describer.ServiceDescription serviceDescription = null; |
+dynamic getTopLevelInterface([Function responseFactory = null]) { |
+ return _test_unions_UnionInterface__(); |
+ } |
+ dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
+ return getAllMojomTypeDefinitions()[typeKey]; |
+ } |
+ dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
+ return getAllMojomTypeDefinitions(); |
+ } |
+} |
+ |
abstract class UnionInterface { |
dynamic echo(PodUnion inVal,[Function responseFactory = null]); |
@@ -2569,6 +3201,9 @@ class UnionInterfaceProxyImpl extends bindings.Proxy { |
String get name => UnionInterfaceName; |
+ service_describer.ServiceDescription get serviceDescription => |
+ new _UnionInterfaceServiceDescription(); |
+ |
void handleResponse(bindings.ServiceMessage message) { |
switch (message.header.type) { |
case kUnionInterface_echo_name: |
@@ -2755,6 +3390,263 @@ class UnionInterfaceStub extends bindings.Stub { |
} |
int get version => 0; |
+ |
+ service_describer.ServiceDescription get serviceDescription => |
+ new _UnionInterfaceServiceDescription(); |
+} |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+var _MojomDesc__ = _initDescriptions(); |
+ |
+Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
+ var map = new Map<String, mojom_types.UserDefinedType>(); |
+ |
+ map["_test_unions_AnEnum__"] = |
+ new mojom_types.UserDefinedType() |
+ ..enumType = _test_unions_AnEnum__(); |
+ |
+ |
+ map["_test_unions_WrapperStruct__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_WrapperStruct__(); |
+ |
+ |
+ map["_test_unions_ObjectUnion__"] = |
+ new mojom_types.UserDefinedType() |
+ ..unionType = _test_unions_ObjectUnion__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_DummyStruct__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_DummyStruct__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_PodUnion__"] = |
+ new mojom_types.UserDefinedType() |
+ ..unionType = _test_unions_PodUnion__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_HandleUnion__"] = |
+ new mojom_types.UserDefinedType() |
+ ..unionType = _test_unions_HandleUnion__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_SmallCache__"] = |
+ new mojom_types.UserDefinedType() |
+ ..interfaceType = _test_unions_SmallCache__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_SmallStruct__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_SmallStruct__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_SmallStructNonNullableUnion__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_SmallStructNonNullableUnion__(); |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_StructNullObjectUnion__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_StructNullObjectUnion__(); |
+ |
+ |
+ map["_test_unions_ObjectOnlyUnion__"] = |
+ new mojom_types.UserDefinedType() |
+ ..unionType = _test_unions_ObjectOnlyUnion__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_SmallObjStruct__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_SmallObjStruct__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_TryNonNullStruct__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_TryNonNullStruct__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_IncludingStruct__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_IncludingStruct__(); |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_SmallCache_SetIntValue_Params__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_SmallCache_SetIntValue_Params__(); |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_SmallCache_GetIntValue_Params__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_SmallCache_GetIntValue_Params__(); |
+ |
+ |
+ |
+ map["_test_unions_SmallCache_GetIntValue_ResponseParams__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_SmallCache_GetIntValue_ResponseParams__(); |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_UnionInterface_Echo_Params__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_UnionInterface_Echo_Params__(); |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_UnionInterface_Echo_ResponseParams__"] = |
+ new mojom_types.UserDefinedType() |
+ ..structType = _test_unions_UnionInterface_Echo_ResponseParams__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_OldUnion__"] = |
+ new mojom_types.UserDefinedType() |
+ ..unionType = _test_unions_OldUnion__(); |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_NewUnion__"] = |
+ new mojom_types.UserDefinedType() |
+ ..unionType = _test_unions_NewUnion__(); |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ map["_test_unions_UnionInterface__"] = |
+ new mojom_types.UserDefinedType() |
+ ..interfaceType = _test_unions_UnionInterface__(); |
+ |
+test_included_unions_mojom.getAllMojomTypeDefinitions().forEach((String s, mojom_types.UserDefinedType udt) { |
+ map[s] = udt; |
+}); |
+ return map; |
+} |
+ |
+Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
+ return _MojomDesc__; |
} |