[fidl] Update goldens
This mechanically regens the goldens by running
fx exec $FUCHSIA_DIR/topaz/bin/fidlgen_dart/regen.sh
this includes changes from xunion deprecation:
https://fuchsia-review.googlesource.com/c/fuchsia/+/371936
Change-Id: Ie5980d93606804ba18ac36a8233da864c9310ef1
Reviewed-on: https://fuchsia-review.googlesource.com/c/topaz/+/377013
Reviewed-by: Pascal Perez <pascallouis@google.com>
Commit-Queue: Pascal Perez <pascallouis@google.com>
diff --git a/bin/fidlgen_dart/goldens/doc_comments.test.json b/bin/fidlgen_dart/goldens/doc_comments.test.json
index 9cafc21..9f4777a 100644
--- a/bin/fidlgen_dart/goldens/doc_comments.test.json
+++ b/bin/fidlgen_dart/goldens/doc_comments.test.json
@@ -387,7 +387,7 @@
"location": {
"filename": "doc_comments.test.fidl",
"line": 48,
- "column": 14
+ "column": 7
},
"maybe_attributes": [
{
diff --git a/bin/fidlgen_dart/goldens/goldens.txt b/bin/fidlgen_dart/goldens/goldens.txt
index a70ae5d..9c307d5 100644
--- a/bin/fidlgen_dart/goldens/goldens.txt
+++ b/bin/fidlgen_dart/goldens/goldens.txt
@@ -79,6 +79,3 @@
union.test.json
union.test.json_async.dart.golden
union.test.json_test.dart.golden
-xunion.test.json
-xunion.test.json_async.dart.golden
-xunion.test.json_test.dart.golden
diff --git a/bin/fidlgen_dart/goldens/nullable.test.json b/bin/fidlgen_dart/goldens/nullable.test.json
index 53ac65b..081f292 100644
--- a/bin/fidlgen_dart/goldens/nullable.test.json
+++ b/bin/fidlgen_dart/goldens/nullable.test.json
@@ -510,7 +510,7 @@
"location": {
"filename": "nullable.test.fidl",
"line": 35,
- "column": 14
+ "column": 7
},
"members": [
{
diff --git a/bin/fidlgen_dart/goldens/placement_of_attributes.test.json b/bin/fidlgen_dart/goldens/placement_of_attributes.test.json
index bd78f7f..d278d9e 100644
--- a/bin/fidlgen_dart/goldens/placement_of_attributes.test.json
+++ b/bin/fidlgen_dart/goldens/placement_of_attributes.test.json
@@ -343,7 +343,7 @@
"location": {
"filename": "example.test.fidl",
"line": 43,
- "column": 14
+ "column": 7
},
"maybe_attributes": [
{
diff --git a/bin/fidlgen_dart/goldens/request_flexible_envelope.test.json b/bin/fidlgen_dart/goldens/request_flexible_envelope.test.json
index 1eb4f4c..b261371 100644
--- a/bin/fidlgen_dart/goldens/request_flexible_envelope.test.json
+++ b/bin/fidlgen_dart/goldens/request_flexible_envelope.test.json
@@ -374,7 +374,7 @@
"location": {
"filename": "request_flexible_envelope.test.fidl",
"line": 8,
- "column": 14
+ "column": 7
},
"members": [
{
diff --git a/bin/fidlgen_dart/goldens/union.test.json b/bin/fidlgen_dart/goldens/union.test.json
index 2e3b2c5..340d682 100644
--- a/bin/fidlgen_dart/goldens/union.test.json
+++ b/bin/fidlgen_dart/goldens/union.test.json
@@ -5,10 +5,205 @@
"bits_declarations": [],
"const_declarations": [],
"enum_declarations": [],
- "interface_declarations": [],
+ "interface_declarations": [
+ {
+ "name": "fidl.test.json/TestProtocol",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 127,
+ "column": 10
+ },
+ "methods": [
+ {
+ "ordinal": 7548006651618394112,
+ "generated_ordinal": 8255078252057434586,
+ "name": "StrictXUnionHenceResponseMayBeStackAllocated",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 128,
+ "column": 5
+ },
+ "has_request": true,
+ "maybe_request": [],
+ "maybe_request_type_shape_v1": {
+ "inline_size": 16,
+ "alignment": 8,
+ "depth": 0,
+ "max_handles": 0,
+ "max_out_of_line": 0,
+ "has_padding": false,
+ "has_flexible_envelope": false,
+ "contains_union": false
+ },
+ "has_response": true,
+ "maybe_response": [
+ {
+ "type": {
+ "kind": "identifier",
+ "identifier": "fidl.test.json/StrictBoundedXUnion",
+ "nullable": false
+ },
+ "name": "xu",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 128,
+ "column": 76
+ },
+ "field_shape_v1": {
+ "offset": 16,
+ "padding": 0
+ }
+ }
+ ],
+ "maybe_response_payload": "fidl.test.json/SomeLongAnonymousPrefix1",
+ "maybe_response_type_shape_v1": {
+ "inline_size": 40,
+ "alignment": 8,
+ "depth": 2,
+ "max_handles": 0,
+ "max_out_of_line": 32,
+ "has_padding": true,
+ "has_flexible_envelope": false,
+ "contains_union": true
+ },
+ "is_composed": false
+ },
+ {
+ "ordinal": 1688296084360658944,
+ "generated_ordinal": 1140178169303334883,
+ "name": "FlexibleXUnionHenceResponseMustBeHeapAllocated",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 129,
+ "column": 5
+ },
+ "has_request": true,
+ "maybe_request": [],
+ "maybe_request_type_shape_v1": {
+ "inline_size": 16,
+ "alignment": 8,
+ "depth": 0,
+ "max_handles": 0,
+ "max_out_of_line": 0,
+ "has_padding": false,
+ "has_flexible_envelope": false,
+ "contains_union": false
+ },
+ "has_response": true,
+ "maybe_response": [
+ {
+ "type": {
+ "kind": "identifier",
+ "identifier": "fidl.test.json/OlderSimpleUnion",
+ "nullable": false
+ },
+ "name": "xu",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 129,
+ "column": 75
+ },
+ "field_shape_v1": {
+ "offset": 16,
+ "padding": 0
+ }
+ }
+ ],
+ "maybe_response_payload": "fidl.test.json/SomeLongAnonymousPrefix3",
+ "maybe_response_type_shape_v1": {
+ "inline_size": 40,
+ "alignment": 8,
+ "depth": 1,
+ "max_handles": 0,
+ "max_out_of_line": 8,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ },
+ "is_composed": false
+ }
+ ]
+ }
+ ],
"service_declarations": [],
"struct_declarations": [
{
+ "name": "fidl.test.json/SomeLongAnonymousPrefix1",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 128,
+ "column": 55
+ },
+ "anonymous": true,
+ "members": [
+ {
+ "type": {
+ "kind": "identifier",
+ "identifier": "fidl.test.json/StrictBoundedXUnion",
+ "nullable": false
+ },
+ "name": "xu",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 128,
+ "column": 76
+ },
+ "field_shape_v1": {
+ "offset": 0,
+ "padding": 0
+ }
+ }
+ ],
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 2,
+ "max_handles": 0,
+ "max_out_of_line": 32,
+ "has_padding": true,
+ "has_flexible_envelope": false,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/SomeLongAnonymousPrefix3",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 129,
+ "column": 57
+ },
+ "anonymous": true,
+ "members": [
+ {
+ "type": {
+ "kind": "identifier",
+ "identifier": "fidl.test.json/OlderSimpleUnion",
+ "nullable": false
+ },
+ "name": "xu",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 129,
+ "column": 75
+ },
+ "field_shape_v1": {
+ "offset": 0,
+ "padding": 0
+ }
+ }
+ ],
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 1,
+ "max_handles": 0,
+ "max_out_of_line": 8,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ }
+ },
+ {
"name": "fidl.test.json/Pizza",
"location": {
"filename": "union.test.fidl",
@@ -125,6 +320,64 @@
"has_flexible_envelope": false,
"contains_union": true
}
+ },
+ {
+ "name": "fidl.test.json/Empty",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 114,
+ "column": 8
+ },
+ "anonymous": false,
+ "members": [],
+ "type_shape_v1": {
+ "inline_size": 1,
+ "alignment": 1,
+ "depth": 0,
+ "max_handles": 0,
+ "max_out_of_line": 0,
+ "has_padding": false,
+ "has_flexible_envelope": false,
+ "contains_union": false
+ }
+ },
+ {
+ "name": "fidl.test.json/StructWithNullableXUnion",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 132,
+ "column": 8
+ },
+ "anonymous": false,
+ "members": [
+ {
+ "type": {
+ "kind": "identifier",
+ "identifier": "fidl.test.json/OlderSimpleUnion",
+ "nullable": true
+ },
+ "name": "x1",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 133,
+ "column": 23
+ },
+ "field_shape_v1": {
+ "offset": 0,
+ "padding": 0
+ }
+ }
+ ],
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 1,
+ "max_handles": 0,
+ "max_out_of_line": 8,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ }
}
],
"table_declarations": [],
@@ -134,7 +387,7 @@
"location": {
"filename": "union.test.fidl",
"line": 11,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -185,7 +438,7 @@
"location": {
"filename": "union.test.fidl",
"line": 16,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -305,7 +558,7 @@
"location": {
"filename": "union.test.fidl",
"line": 28,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -356,7 +609,7 @@
"location": {
"filename": "union.test.fidl",
"line": 33,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -490,7 +743,7 @@
"location": {
"filename": "union.test.fidl",
"line": 45,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -557,7 +810,7 @@
"location": {
"filename": "union.test.fidl",
"line": 51,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -592,7 +845,7 @@
"location": {
"filename": "union.test.fidl",
"line": 55,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -650,7 +903,7 @@
"location": {
"filename": "union.test.fidl",
"line": 61,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -693,12 +946,552 @@
"has_flexible_envelope": false,
"contains_union": true
}
+ },
+ {
+ "name": "fidl.test.json/FlexibleFoo",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 70,
+ "column": 16
+ },
+ "members": [
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "s",
+ "type": {
+ "kind": "string",
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 71,
+ "column": 15
+ }
+ },
+ {
+ "ordinal": 2,
+ "reserved": false,
+ "name": "i",
+ "type": {
+ "kind": "primitive",
+ "subtype": "int32"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 72,
+ "column": 14
+ }
+ }
+ ],
+ "strict": false,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 2,
+ "max_handles": 0,
+ "max_out_of_line": 4294967295,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/StrictFoo",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 75,
+ "column": 14
+ },
+ "members": [
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "s",
+ "type": {
+ "kind": "string",
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 76,
+ "column": 15
+ }
+ },
+ {
+ "ordinal": 2,
+ "reserved": false,
+ "name": "i",
+ "type": {
+ "kind": "primitive",
+ "subtype": "int32"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 77,
+ "column": 14
+ }
+ }
+ ],
+ "strict": true,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 2,
+ "max_handles": 0,
+ "max_out_of_line": 4294967295,
+ "has_padding": true,
+ "has_flexible_envelope": false,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/ExplicitFoo",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 80,
+ "column": 16
+ },
+ "members": [
+ {
+ "ordinal": 2,
+ "reserved": false,
+ "name": "s",
+ "type": {
+ "kind": "string",
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 81,
+ "column": 15
+ }
+ },
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "i",
+ "type": {
+ "kind": "primitive",
+ "subtype": "int32"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 82,
+ "column": 14
+ }
+ },
+ {
+ "ordinal": 3,
+ "reserved": true,
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 83,
+ "column": 5
+ }
+ }
+ ],
+ "strict": false,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 2,
+ "max_handles": 0,
+ "max_out_of_line": 4294967295,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/ExplicitStrictFoo",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 86,
+ "column": 14
+ },
+ "members": [
+ {
+ "ordinal": 1,
+ "reserved": true,
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 87,
+ "column": 5
+ }
+ },
+ {
+ "ordinal": 3,
+ "reserved": false,
+ "name": "s",
+ "type": {
+ "kind": "string",
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 88,
+ "column": 15
+ }
+ },
+ {
+ "ordinal": 2,
+ "reserved": false,
+ "name": "i",
+ "type": {
+ "kind": "primitive",
+ "subtype": "int32"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 89,
+ "column": 14
+ }
+ }
+ ],
+ "strict": true,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 2,
+ "max_handles": 0,
+ "max_out_of_line": 4294967295,
+ "has_padding": true,
+ "has_flexible_envelope": false,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/OlderSimpleUnion",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 92,
+ "column": 16
+ },
+ "members": [
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "i",
+ "type": {
+ "kind": "primitive",
+ "subtype": "int64"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 93,
+ "column": 14
+ }
+ },
+ {
+ "ordinal": 2,
+ "reserved": false,
+ "name": "f",
+ "type": {
+ "kind": "primitive",
+ "subtype": "float32"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 94,
+ "column": 16
+ }
+ }
+ ],
+ "strict": false,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 1,
+ "max_handles": 0,
+ "max_out_of_line": 8,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/NewerSimpleUnion",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 97,
+ "column": 16
+ },
+ "members": [
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "i",
+ "type": {
+ "kind": "primitive",
+ "subtype": "int64"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 100,
+ "column": 14
+ }
+ },
+ {
+ "ordinal": 2,
+ "reserved": false,
+ "name": "s",
+ "type": {
+ "kind": "string",
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 102,
+ "column": 15
+ }
+ },
+ {
+ "ordinal": 3,
+ "reserved": false,
+ "name": "v",
+ "type": {
+ "kind": "vector",
+ "element_type": {
+ "kind": "string",
+ "nullable": false
+ },
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 103,
+ "column": 23
+ }
+ }
+ ],
+ "strict": false,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 3,
+ "max_handles": 0,
+ "max_out_of_line": 4294967295,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/StrictSimpleXUnion",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 108,
+ "column": 14
+ },
+ "members": [
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "i",
+ "type": {
+ "kind": "primitive",
+ "subtype": "int32"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 109,
+ "column": 14
+ }
+ },
+ {
+ "ordinal": 2,
+ "reserved": false,
+ "name": "f",
+ "type": {
+ "kind": "primitive",
+ "subtype": "float32"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 110,
+ "column": 16
+ }
+ },
+ {
+ "ordinal": 3,
+ "reserved": false,
+ "name": "s",
+ "type": {
+ "kind": "string",
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 111,
+ "column": 15
+ }
+ }
+ ],
+ "strict": true,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 2,
+ "max_handles": 0,
+ "max_out_of_line": 4294967295,
+ "has_padding": true,
+ "has_flexible_envelope": false,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/XUnionContainingEmptyStruct",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 117,
+ "column": 16
+ },
+ "members": [
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "empty",
+ "type": {
+ "kind": "identifier",
+ "identifier": "fidl.test.json/Empty",
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 120,
+ "column": 14
+ }
+ }
+ ],
+ "strict": false,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 1,
+ "max_handles": 0,
+ "max_out_of_line": 8,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/StrictBoundedXUnion",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 123,
+ "column": 14
+ },
+ "members": [
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "v",
+ "type": {
+ "kind": "vector",
+ "element_type": {
+ "kind": "primitive",
+ "subtype": "uint8"
+ },
+ "maybe_element_count": 10,
+ "nullable": false
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 124,
+ "column": 25
+ }
+ }
+ ],
+ "strict": true,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 2,
+ "max_handles": 0,
+ "max_out_of_line": 32,
+ "has_padding": true,
+ "has_flexible_envelope": false,
+ "contains_union": true
+ }
+ },
+ {
+ "name": "fidl.test.json/ExplicitXUnion",
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 136,
+ "column": 16
+ },
+ "members": [
+ {
+ "ordinal": 3,
+ "reserved": true,
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 137,
+ "column": 5
+ }
+ },
+ {
+ "ordinal": 2,
+ "reserved": true,
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 138,
+ "column": 5
+ }
+ },
+ {
+ "ordinal": 1,
+ "reserved": false,
+ "name": "i",
+ "type": {
+ "kind": "primitive",
+ "subtype": "int64"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 139,
+ "column": 14
+ }
+ },
+ {
+ "ordinal": 4,
+ "reserved": false,
+ "name": "f",
+ "type": {
+ "kind": "primitive",
+ "subtype": "float32"
+ },
+ "location": {
+ "filename": "union.test.fidl",
+ "line": 140,
+ "column": 16
+ }
+ }
+ ],
+ "strict": false,
+ "type_shape_v1": {
+ "inline_size": 24,
+ "alignment": 8,
+ "depth": 1,
+ "max_handles": 0,
+ "max_out_of_line": 8,
+ "has_padding": true,
+ "has_flexible_envelope": true,
+ "contains_union": true
+ }
}
],
"type_alias_declarations": [],
"declaration_order": [
"fidl.test.json/Union",
+ "fidl.test.json/StructWithNullableXUnion",
"fidl.test.json/StrictUnion",
+ "fidl.test.json/StrictSimpleXUnion",
+ "fidl.test.json/StrictFoo",
+ "fidl.test.json/StrictBoundedXUnion",
"fidl.test.json/ReverseOrdinalUnion",
"fidl.test.json/Pizza",
"fidl.test.json/Pasta",
@@ -706,15 +1499,31 @@
"fidl.test.json/PizzaOrPasta",
"fidl.test.json/FlexiblePizzaOrPasta",
"fidl.test.json/ExplicitPizzaOrPasta",
+ "fidl.test.json/OlderSimpleUnion",
+ "fidl.test.json/TestProtocol",
"fidl.test.json/NullableUnionStruct",
+ "fidl.test.json/NewerSimpleUnion",
"fidl.test.json/FlexibleUnion",
+ "fidl.test.json/FlexibleFoo",
"fidl.test.json/FieldCollision",
- "fidl.test.json/ExplicitUnion"
+ "fidl.test.json/ExplicitXUnion",
+ "fidl.test.json/ExplicitUnion",
+ "fidl.test.json/ExplicitStrictFoo",
+ "fidl.test.json/ExplicitFoo",
+ "fidl.test.json/Empty",
+ "fidl.test.json/XUnionContainingEmptyStruct"
],
"declarations": {
+ "fidl.test.json/TestProtocol": "interface",
+ "fidl.test.json/SomeLongAnonymousPrefix0": "struct",
+ "fidl.test.json/SomeLongAnonymousPrefix1": "struct",
+ "fidl.test.json/SomeLongAnonymousPrefix2": "struct",
+ "fidl.test.json/SomeLongAnonymousPrefix3": "struct",
"fidl.test.json/Pizza": "struct",
"fidl.test.json/Pasta": "struct",
"fidl.test.json/NullableUnionStruct": "struct",
+ "fidl.test.json/Empty": "struct",
+ "fidl.test.json/StructWithNullableXUnion": "struct",
"fidl.test.json/PizzaOrPasta": "union",
"fidl.test.json/ExplicitPizzaOrPasta": "union",
"fidl.test.json/FlexiblePizzaOrPasta": "union",
@@ -724,6 +1533,16 @@
"fidl.test.json/StrictUnion": "union",
"fidl.test.json/FieldCollision": "union",
"fidl.test.json/ExplicitUnion": "union",
- "fidl.test.json/ReverseOrdinalUnion": "union"
+ "fidl.test.json/ReverseOrdinalUnion": "union",
+ "fidl.test.json/FlexibleFoo": "union",
+ "fidl.test.json/StrictFoo": "union",
+ "fidl.test.json/ExplicitFoo": "union",
+ "fidl.test.json/ExplicitStrictFoo": "union",
+ "fidl.test.json/OlderSimpleUnion": "union",
+ "fidl.test.json/NewerSimpleUnion": "union",
+ "fidl.test.json/StrictSimpleXUnion": "union",
+ "fidl.test.json/XUnionContainingEmptyStruct": "union",
+ "fidl.test.json/StrictBoundedXUnion": "union",
+ "fidl.test.json/ExplicitXUnion": "union"
}
}
diff --git a/bin/fidlgen_dart/goldens/union.test.json_async.dart.golden b/bin/fidlgen_dart/goldens/union.test.json_async.dart.golden
index e2d164d..6e28d2e 100644
--- a/bin/fidlgen_dart/goldens/union.test.json_async.dart.golden
+++ b/bin/fidlgen_dart/goldens/union.test.json_async.dart.golden
@@ -995,6 +995,941 @@
flexible: false,
);
+enum FlexibleFooTag {
+ $unknown,
+ s, // 0x1
+ i, // 0x2
+}
+
+const Map<int, FlexibleFooTag> _FlexibleFooTag_map = {
+ 1: FlexibleFooTag.s,
+ 2: FlexibleFooTag.i,
+};
+
+class FlexibleFoo extends $fidl.XUnion {
+ const FlexibleFoo.withS(String value)
+ : _ordinal = 1,
+ _data = value;
+
+ const FlexibleFoo.withI(int value)
+ : _ordinal = 2,
+ _data = value;
+
+ FlexibleFoo._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ FlexibleFooTag get $tag {
+ final FlexibleFooTag $rawtag = _FlexibleFooTag_map[_ordinal];
+ return $rawtag == null ? FlexibleFooTag.$unknown : $rawtag;
+ }
+
+ String get s {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ int get i {
+ if (_ordinal != 2) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 1:
+ return 'FlexibleFoo.s($s)';
+ case 2:
+ return 'FlexibleFoo.i($i)';
+ default:
+ return 'FlexibleFoo.<UNKNOWN>';
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static FlexibleFoo _ctor(int ordinal, Object data) {
+ return FlexibleFoo._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<FlexibleFoo> kFlexibleFoo_Type =
+ $fidl.XUnionType<FlexibleFoo>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 2: $fidl.Int32Type(),
+ },
+ ctor: FlexibleFoo._ctor,
+ nullable: false,
+ flexible: true,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<FlexibleFoo> kFlexibleFoo_OptType =
+ $fidl.XUnionType<FlexibleFoo>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 2: $fidl.Int32Type(),
+ },
+ ctor: FlexibleFoo._ctor,
+ nullable: true,
+ flexible: true,
+);
+
+enum StrictFooTag {
+ s, // 0x1
+ i, // 0x2
+}
+
+const Map<int, StrictFooTag> _StrictFooTag_map = {
+ 1: StrictFooTag.s,
+ 2: StrictFooTag.i,
+};
+
+class StrictFoo extends $fidl.XUnion {
+ const StrictFoo.withS(String value)
+ : _ordinal = 1,
+ _data = value;
+
+ const StrictFoo.withI(int value)
+ : _ordinal = 2,
+ _data = value;
+
+ StrictFoo._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ StrictFooTag get $tag => _StrictFooTag_map[_ordinal];
+
+ String get s {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ int get i {
+ if (_ordinal != 2) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 1:
+ return 'StrictFoo.s($s)';
+ case 2:
+ return 'StrictFoo.i($i)';
+ default:
+ return null;
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static StrictFoo _ctor(int ordinal, Object data) {
+ return StrictFoo._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<StrictFoo> kStrictFoo_Type = $fidl.XUnionType<StrictFoo>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 2: $fidl.Int32Type(),
+ },
+ ctor: StrictFoo._ctor,
+ nullable: false,
+ flexible: false,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<StrictFoo> kStrictFoo_OptType =
+ $fidl.XUnionType<StrictFoo>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 2: $fidl.Int32Type(),
+ },
+ ctor: StrictFoo._ctor,
+ nullable: true,
+ flexible: false,
+);
+
+enum ExplicitFooTag {
+ $unknown,
+ s, // 0x2
+ i, // 0x1
+}
+
+const Map<int, ExplicitFooTag> _ExplicitFooTag_map = {
+ 2: ExplicitFooTag.s,
+ 1: ExplicitFooTag.i,
+};
+
+class ExplicitFoo extends $fidl.XUnion {
+ const ExplicitFoo.withS(String value)
+ : _ordinal = 2,
+ _data = value;
+
+ const ExplicitFoo.withI(int value)
+ : _ordinal = 1,
+ _data = value;
+
+ ExplicitFoo._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ ExplicitFooTag get $tag {
+ final ExplicitFooTag $rawtag = _ExplicitFooTag_map[_ordinal];
+ return $rawtag == null ? ExplicitFooTag.$unknown : $rawtag;
+ }
+
+ String get s {
+ if (_ordinal != 2) {
+ return null;
+ }
+ return _data;
+ }
+
+ int get i {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 2:
+ return 'ExplicitFoo.s($s)';
+ case 1:
+ return 'ExplicitFoo.i($i)';
+ default:
+ return 'ExplicitFoo.<UNKNOWN>';
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static ExplicitFoo _ctor(int ordinal, Object data) {
+ return ExplicitFoo._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<ExplicitFoo> kExplicitFoo_Type =
+ $fidl.XUnionType<ExplicitFoo>(
+ members: <int, $fidl.FidlType>{
+ 2: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 1: $fidl.Int32Type(),
+ },
+ ctor: ExplicitFoo._ctor,
+ nullable: false,
+ flexible: true,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<ExplicitFoo> kExplicitFoo_OptType =
+ $fidl.XUnionType<ExplicitFoo>(
+ members: <int, $fidl.FidlType>{
+ 2: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 1: $fidl.Int32Type(),
+ },
+ ctor: ExplicitFoo._ctor,
+ nullable: true,
+ flexible: true,
+);
+
+enum ExplicitStrictFooTag {
+ s, // 0x3
+ i, // 0x2
+}
+
+const Map<int, ExplicitStrictFooTag> _ExplicitStrictFooTag_map = {
+ 3: ExplicitStrictFooTag.s,
+ 2: ExplicitStrictFooTag.i,
+};
+
+class ExplicitStrictFoo extends $fidl.XUnion {
+ const ExplicitStrictFoo.withS(String value)
+ : _ordinal = 3,
+ _data = value;
+
+ const ExplicitStrictFoo.withI(int value)
+ : _ordinal = 2,
+ _data = value;
+
+ ExplicitStrictFoo._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ ExplicitStrictFooTag get $tag => _ExplicitStrictFooTag_map[_ordinal];
+
+ String get s {
+ if (_ordinal != 3) {
+ return null;
+ }
+ return _data;
+ }
+
+ int get i {
+ if (_ordinal != 2) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 3:
+ return 'ExplicitStrictFoo.s($s)';
+ case 2:
+ return 'ExplicitStrictFoo.i($i)';
+ default:
+ return null;
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static ExplicitStrictFoo _ctor(int ordinal, Object data) {
+ return ExplicitStrictFoo._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<ExplicitStrictFoo> kExplicitStrictFoo_Type =
+ $fidl.XUnionType<ExplicitStrictFoo>(
+ members: <int, $fidl.FidlType>{
+ 3: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 2: $fidl.Int32Type(),
+ },
+ ctor: ExplicitStrictFoo._ctor,
+ nullable: false,
+ flexible: false,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<ExplicitStrictFoo> kExplicitStrictFoo_OptType =
+ $fidl.XUnionType<ExplicitStrictFoo>(
+ members: <int, $fidl.FidlType>{
+ 3: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 2: $fidl.Int32Type(),
+ },
+ ctor: ExplicitStrictFoo._ctor,
+ nullable: true,
+ flexible: false,
+);
+
+enum OlderSimpleUnionTag {
+ $unknown,
+ i, // 0x1
+ f, // 0x2
+}
+
+const Map<int, OlderSimpleUnionTag> _OlderSimpleUnionTag_map = {
+ 1: OlderSimpleUnionTag.i,
+ 2: OlderSimpleUnionTag.f,
+};
+
+class OlderSimpleUnion extends $fidl.XUnion {
+ const OlderSimpleUnion.withI(int value)
+ : _ordinal = 1,
+ _data = value;
+
+ const OlderSimpleUnion.withF(double value)
+ : _ordinal = 2,
+ _data = value;
+
+ OlderSimpleUnion._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ OlderSimpleUnionTag get $tag {
+ final OlderSimpleUnionTag $rawtag = _OlderSimpleUnionTag_map[_ordinal];
+ return $rawtag == null ? OlderSimpleUnionTag.$unknown : $rawtag;
+ }
+
+ int get i {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ double get f {
+ if (_ordinal != 2) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 1:
+ return 'OlderSimpleUnion.i($i)';
+ case 2:
+ return 'OlderSimpleUnion.f($f)';
+ default:
+ return 'OlderSimpleUnion.<UNKNOWN>';
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static OlderSimpleUnion _ctor(int ordinal, Object data) {
+ return OlderSimpleUnion._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<OlderSimpleUnion> kOlderSimpleUnion_Type =
+ $fidl.XUnionType<OlderSimpleUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.Int64Type(),
+ 2: $fidl.Float32Type(),
+ },
+ ctor: OlderSimpleUnion._ctor,
+ nullable: false,
+ flexible: true,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<OlderSimpleUnion> kOlderSimpleUnion_OptType =
+ $fidl.XUnionType<OlderSimpleUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.Int64Type(),
+ 2: $fidl.Float32Type(),
+ },
+ ctor: OlderSimpleUnion._ctor,
+ nullable: true,
+ flexible: true,
+);
+
+enum NewerSimpleUnionTag {
+ $unknown,
+ i, // 0x1
+ s, // 0x2
+ v, // 0x3
+}
+
+const Map<int, NewerSimpleUnionTag> _NewerSimpleUnionTag_map = {
+ 1: NewerSimpleUnionTag.i,
+ 2: NewerSimpleUnionTag.s,
+ 3: NewerSimpleUnionTag.v,
+};
+
+class NewerSimpleUnion extends $fidl.XUnion {
+ const NewerSimpleUnion.withI(int value)
+ : _ordinal = 1,
+ _data = value;
+
+ const NewerSimpleUnion.withS(String value)
+ : _ordinal = 2,
+ _data = value;
+
+ const NewerSimpleUnion.withV(List<String> value)
+ : _ordinal = 3,
+ _data = value;
+
+ NewerSimpleUnion._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ NewerSimpleUnionTag get $tag {
+ final NewerSimpleUnionTag $rawtag = _NewerSimpleUnionTag_map[_ordinal];
+ return $rawtag == null ? NewerSimpleUnionTag.$unknown : $rawtag;
+ }
+
+ int get i {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ String get s {
+ if (_ordinal != 2) {
+ return null;
+ }
+ return _data;
+ }
+
+ List<String> get v {
+ if (_ordinal != 3) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 1:
+ return 'NewerSimpleUnion.i($i)';
+ case 2:
+ return 'NewerSimpleUnion.s($s)';
+ case 3:
+ return 'NewerSimpleUnion.v($v)';
+ default:
+ return 'NewerSimpleUnion.<UNKNOWN>';
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static NewerSimpleUnion _ctor(int ordinal, Object data) {
+ return NewerSimpleUnion._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<NewerSimpleUnion> kNewerSimpleUnion_Type =
+ $fidl.XUnionType<NewerSimpleUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.Int64Type(),
+ 2: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 3: $fidl.VectorType<List<String>>(
+ element: $fidl.StringType(maybeElementCount: null, nullable: false),
+ maybeElementCount: null,
+ nullable: false),
+ },
+ ctor: NewerSimpleUnion._ctor,
+ nullable: false,
+ flexible: true,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<NewerSimpleUnion> kNewerSimpleUnion_OptType =
+ $fidl.XUnionType<NewerSimpleUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.Int64Type(),
+ 2: $fidl.StringType(maybeElementCount: null, nullable: false),
+ 3: $fidl.VectorType<List<String>>(
+ element: $fidl.StringType(maybeElementCount: null, nullable: false),
+ maybeElementCount: null,
+ nullable: false),
+ },
+ ctor: NewerSimpleUnion._ctor,
+ nullable: true,
+ flexible: true,
+);
+
+enum StrictSimpleXUnionTag {
+ i, // 0x1
+ f, // 0x2
+ s, // 0x3
+}
+
+const Map<int, StrictSimpleXUnionTag> _StrictSimpleXUnionTag_map = {
+ 1: StrictSimpleXUnionTag.i,
+ 2: StrictSimpleXUnionTag.f,
+ 3: StrictSimpleXUnionTag.s,
+};
+
+class StrictSimpleXUnion extends $fidl.XUnion {
+ const StrictSimpleXUnion.withI(int value)
+ : _ordinal = 1,
+ _data = value;
+
+ const StrictSimpleXUnion.withF(double value)
+ : _ordinal = 2,
+ _data = value;
+
+ const StrictSimpleXUnion.withS(String value)
+ : _ordinal = 3,
+ _data = value;
+
+ StrictSimpleXUnion._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ StrictSimpleXUnionTag get $tag => _StrictSimpleXUnionTag_map[_ordinal];
+
+ int get i {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ double get f {
+ if (_ordinal != 2) {
+ return null;
+ }
+ return _data;
+ }
+
+ String get s {
+ if (_ordinal != 3) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 1:
+ return 'StrictSimpleXUnion.i($i)';
+ case 2:
+ return 'StrictSimpleXUnion.f($f)';
+ case 3:
+ return 'StrictSimpleXUnion.s($s)';
+ default:
+ return null;
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static StrictSimpleXUnion _ctor(int ordinal, Object data) {
+ return StrictSimpleXUnion._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<StrictSimpleXUnion> kStrictSimpleXUnion_Type =
+ $fidl.XUnionType<StrictSimpleXUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.Int32Type(),
+ 2: $fidl.Float32Type(),
+ 3: $fidl.StringType(maybeElementCount: null, nullable: false),
+ },
+ ctor: StrictSimpleXUnion._ctor,
+ nullable: false,
+ flexible: false,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<StrictSimpleXUnion> kStrictSimpleXUnion_OptType =
+ $fidl.XUnionType<StrictSimpleXUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.Int32Type(),
+ 2: $fidl.Float32Type(),
+ 3: $fidl.StringType(maybeElementCount: null, nullable: false),
+ },
+ ctor: StrictSimpleXUnion._ctor,
+ nullable: true,
+ flexible: false,
+);
+
+enum XUnionContainingEmptyStructTag {
+ $unknown,
+ empty, // 0x1
+}
+
+const Map<int, XUnionContainingEmptyStructTag>
+ _XUnionContainingEmptyStructTag_map = {
+ 1: XUnionContainingEmptyStructTag.empty,
+};
+
+class XUnionContainingEmptyStruct extends $fidl.XUnion {
+ const XUnionContainingEmptyStruct.withEmpty(Empty value)
+ : _ordinal = 1,
+ _data = value;
+
+ XUnionContainingEmptyStruct._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ XUnionContainingEmptyStructTag get $tag {
+ final XUnionContainingEmptyStructTag $rawtag =
+ _XUnionContainingEmptyStructTag_map[_ordinal];
+ return $rawtag == null ? XUnionContainingEmptyStructTag.$unknown : $rawtag;
+ }
+
+ Empty get empty {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 1:
+ return 'XUnionContainingEmptyStruct.empty($empty)';
+ default:
+ return 'XUnionContainingEmptyStruct.<UNKNOWN>';
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static XUnionContainingEmptyStruct _ctor(int ordinal, Object data) {
+ return XUnionContainingEmptyStruct._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<XUnionContainingEmptyStruct>
+ kXUnionContainingEmptyStruct_Type =
+ $fidl.XUnionType<XUnionContainingEmptyStruct>(
+ members: <int, $fidl.FidlType>{
+ 1: kEmpty_Type,
+ },
+ ctor: XUnionContainingEmptyStruct._ctor,
+ nullable: false,
+ flexible: true,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<XUnionContainingEmptyStruct>
+ kXUnionContainingEmptyStruct_OptType =
+ $fidl.XUnionType<XUnionContainingEmptyStruct>(
+ members: <int, $fidl.FidlType>{
+ 1: kEmpty_Type,
+ },
+ ctor: XUnionContainingEmptyStruct._ctor,
+ nullable: true,
+ flexible: true,
+);
+
+enum StrictBoundedXUnionTag {
+ v, // 0x1
+}
+
+const Map<int, StrictBoundedXUnionTag> _StrictBoundedXUnionTag_map = {
+ 1: StrictBoundedXUnionTag.v,
+};
+
+class StrictBoundedXUnion extends $fidl.XUnion {
+ const StrictBoundedXUnion.withV(Uint8List value)
+ : _ordinal = 1,
+ _data = value;
+
+ StrictBoundedXUnion._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ StrictBoundedXUnionTag get $tag => _StrictBoundedXUnionTag_map[_ordinal];
+
+ Uint8List get v {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 1:
+ return 'StrictBoundedXUnion.v($v)';
+ default:
+ return null;
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static StrictBoundedXUnion _ctor(int ordinal, Object data) {
+ return StrictBoundedXUnion._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<StrictBoundedXUnion> kStrictBoundedXUnion_Type =
+ $fidl.XUnionType<StrictBoundedXUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.VectorType<Uint8List>(
+ element: $fidl.Uint8Type(), maybeElementCount: 10, nullable: false),
+ },
+ ctor: StrictBoundedXUnion._ctor,
+ nullable: false,
+ flexible: false,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<StrictBoundedXUnion> kStrictBoundedXUnion_OptType =
+ $fidl.XUnionType<StrictBoundedXUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.VectorType<Uint8List>(
+ element: $fidl.Uint8Type(), maybeElementCount: 10, nullable: false),
+ },
+ ctor: StrictBoundedXUnion._ctor,
+ nullable: true,
+ flexible: false,
+);
+
+enum ExplicitXUnionTag {
+ $unknown,
+ i, // 0x1
+ f, // 0x4
+}
+
+const Map<int, ExplicitXUnionTag> _ExplicitXUnionTag_map = {
+ 1: ExplicitXUnionTag.i,
+ 4: ExplicitXUnionTag.f,
+};
+
+class ExplicitXUnion extends $fidl.XUnion {
+ const ExplicitXUnion.withI(int value)
+ : _ordinal = 1,
+ _data = value;
+
+ const ExplicitXUnion.withF(double value)
+ : _ordinal = 4,
+ _data = value;
+
+ ExplicitXUnion._(int ordinal, Object data)
+ : _ordinal = ordinal,
+ _data = data;
+
+ final int _ordinal;
+ final _data;
+
+ ExplicitXUnionTag get $tag {
+ final ExplicitXUnionTag $rawtag = _ExplicitXUnionTag_map[_ordinal];
+ return $rawtag == null ? ExplicitXUnionTag.$unknown : $rawtag;
+ }
+
+ int get i {
+ if (_ordinal != 1) {
+ return null;
+ }
+ return _data;
+ }
+
+ double get f {
+ if (_ordinal != 4) {
+ return null;
+ }
+ return _data;
+ }
+
+ @override
+ String toString() {
+ switch (_ordinal) {
+ case 1:
+ return 'ExplicitXUnion.i($i)';
+ case 4:
+ return 'ExplicitXUnion.f($f)';
+ default:
+ return 'ExplicitXUnion.<UNKNOWN>';
+ }
+ }
+
+ @override
+ int get $ordinal => _ordinal;
+
+ @override
+ Object get $data => _data;
+
+ static ExplicitXUnion _ctor(int ordinal, Object data) {
+ return ExplicitXUnion._(ordinal, data);
+ }
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<ExplicitXUnion> kExplicitXUnion_Type =
+ $fidl.XUnionType<ExplicitXUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.Int64Type(),
+ 4: $fidl.Float32Type(),
+ },
+ ctor: ExplicitXUnion._ctor,
+ nullable: false,
+ flexible: true,
+);
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.XUnionType<ExplicitXUnion> kExplicitXUnion_OptType =
+ $fidl.XUnionType<ExplicitXUnion>(
+ members: <int, $fidl.FidlType>{
+ 1: $fidl.Int64Type(),
+ 4: $fidl.Float32Type(),
+ },
+ ctor: ExplicitXUnion._ctor,
+ nullable: true,
+ flexible: true,
+);
+
class Pizza extends $fidl.Struct {
const Pizza({
@required this.toppings,
@@ -1131,5 +2066,393 @@
ctor: NullableUnionStruct._ctor,
);
+class Empty extends $fidl.Struct {
+ const Empty({
+ this.reserved: 0x0,
+ });
+ Empty.clone(
+ Empty $orig, {
+ int reserved,
+ }) : this(
+ reserved: reserved ?? $orig.reserved,
+ );
+
+ Empty._(List<Object> argv) : reserved = argv[0];
+ final int reserved;
+
+ @override
+ List<Object> get $fields {
+ return <Object>[
+ reserved,
+ ];
+ }
+
+ @override
+ String toString() {
+ // ignore: prefer_interpolation_to_compose_strings
+ return r'Empty' r'(reserved: ' + reserved.toString() + r')';
+ }
+
+ static Empty _ctor(List<Object> argv) => Empty._(argv);
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.StructType<Empty> kEmpty_Type = $fidl.StructType<Empty>(
+ inlineSize: 1,
+ members: <$fidl.MemberType>[
+ $fidl.MemberType<int>(type: $fidl.Uint8Type(), offset: 0),
+ ],
+ ctor: Empty._ctor,
+);
+
+class StructWithNullableXUnion extends $fidl.Struct {
+ const StructWithNullableXUnion({
+ this.x1,
+ });
+ StructWithNullableXUnion.clone(
+ StructWithNullableXUnion $orig, {
+ OlderSimpleUnion x1,
+ }) : this(
+ x1: x1 ?? $orig.x1,
+ );
+
+ StructWithNullableXUnion.cloneWithout(
+ StructWithNullableXUnion $orig, {
+ bool x1,
+ }) : this(
+ x1: x1 ? null : $orig.x1,
+ );
+
+ StructWithNullableXUnion._(List<Object> argv) : x1 = argv[0];
+ final OlderSimpleUnion x1;
+
+ @override
+ List<Object> get $fields {
+ return <Object>[
+ x1,
+ ];
+ }
+
+ @override
+ String toString() {
+ // ignore: prefer_interpolation_to_compose_strings
+ return r'StructWithNullableXUnion' r'(x1: ' + x1.toString() + r')';
+ }
+
+ static StructWithNullableXUnion _ctor(List<Object> argv) =>
+ StructWithNullableXUnion._(argv);
+}
+
+// See FIDL-308:
+// ignore: recursive_compile_time_constant
+const $fidl.StructType<StructWithNullableXUnion>
+ kStructWithNullableXUnion_Type = $fidl.StructType<StructWithNullableXUnion>(
+ inlineSize: 24,
+ members: <$fidl.MemberType>[
+ $fidl.MemberType<OlderSimpleUnion>(
+ type: kOlderSimpleUnion_OptType, offset: 0),
+ ],
+ ctor: StructWithNullableXUnion._ctor,
+);
+
// ignore: unused_element, avoid_private_typedef_functions
typedef _VoidCallback = void Function();
+
+// strictXUnionHenceResponseMayBeStackAllocated: () -> (StrictBoundedXUnion xu)
+const int _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal =
+ 0x68bfe80f00000000;
+const int
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal =
+ 0x728fedeed6ef99da;
+const $fidl.MethodType
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type =
+ $fidl.MethodType(
+ request: null,
+ response: <$fidl.MemberType>[
+ $fidl.MemberType<StrictBoundedXUnion>(
+ type: kStrictBoundedXUnion_Type, offset: 0),
+ ],
+ name: r"TestProtocol.StrictXUnionHenceResponseMayBeStackAllocated",
+ requestInlineSize: 0,
+ responseInlineSize: 24,
+);
+// flexibleXUnionHenceResponseMustBeHeapAllocated: () -> (OlderSimpleUnion xu)
+const int
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal =
+ 0x176e085800000000;
+const int
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal =
+ 0xfd2ba0109faffe3;
+const $fidl.MethodType
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type =
+ $fidl.MethodType(
+ request: null,
+ response: <$fidl.MemberType>[
+ $fidl.MemberType<OlderSimpleUnion>(type: kOlderSimpleUnion_Type, offset: 0),
+ ],
+ name: r"TestProtocol.FlexibleXUnionHenceResponseMustBeHeapAllocated",
+ requestInlineSize: 0,
+ responseInlineSize: 24,
+);
+
+abstract class TestProtocol extends $fidl.Service {
+ static const String $serviceName = null;
+ @override
+ $fidl.ServiceData get $serviceData => TestProtocolData();
+ $async.Future<StrictBoundedXUnion>
+ strictXUnionHenceResponseMayBeStackAllocated();
+ $async.Future<OlderSimpleUnion>
+ flexibleXUnionHenceResponseMustBeHeapAllocated();
+}
+
+class TestProtocolData implements $fidl.ServiceData<TestProtocol> {
+ const TestProtocolData();
+
+ @override
+ String getName() {
+ return TestProtocol.$serviceName;
+ }
+
+ @override
+ $fidl.AsyncBinding getBinding() {
+ return TestProtocolBinding();
+ }
+}
+
+class TestProtocolProxy extends $fidl.AsyncProxy<TestProtocol>
+ implements TestProtocol {
+ TestProtocolProxy()
+ : super($fidl.AsyncProxyController<TestProtocol>(
+ $serviceName: null, $interfaceName: r'TestProtocol')) {
+ ctrl.onResponse = _handleResponse;
+ }
+
+ @override
+ $fidl.ServiceData get $serviceData => TestProtocolData();
+
+ void _handleEvent($fidl.Message $message) {
+ final $fidl.Decoder $decoder = $fidl.Decoder($message)
+ ..claimMemory($fidl.kMessageHeaderSize);
+ switch ($message.ordinal) {
+ default:
+ ctrl.proxyError(
+ $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
+ ctrl.close();
+ break;
+ }
+ }
+
+ void _handleResponse($fidl.Message $message) {
+ final int $txid = $message.txid;
+ if ($txid == 0) {
+ _handleEvent($message);
+ return;
+ }
+ final $async.Completer $completer = ctrl.getCompleter($txid);
+ if ($completer == null) {
+ $message.closeHandles();
+ return;
+ }
+ final $fidl.Decoder $decoder = $fidl.Decoder($message)
+ ..claimMemory($fidl.kMessageHeaderSize);
+ switch ($message.ordinal) {
+ case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal:
+ case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal:
+ final String _name =
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
+ .name;
+ try {
+ Timeline.startSync(_name);
+ final List<$fidl.MemberType> $types =
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
+ .response;
+ $decoder.claimMemory(
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
+ .decodeResponseInlineSize($decoder));
+ // ignore: prefer_const_declarations
+ final $response =
+ $types[0].decode($decoder, $fidl.kMessageHeaderSize);
+
+ $completer.complete($response);
+
+ // ignore: avoid_catches_without_on_clauses
+ } catch (_e) {
+ ctrl.proxyError($fidl.FidlError(
+ 'Exception handling method response $_name: $_e'));
+ ctrl.close();
+ rethrow;
+ } finally {
+ Timeline.finishSync();
+ }
+ break;
+ case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal:
+ case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal:
+ final String _name =
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
+ .name;
+ try {
+ Timeline.startSync(_name);
+ final List<$fidl.MemberType> $types =
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
+ .response;
+ $decoder.claimMemory(
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
+ .decodeResponseInlineSize($decoder));
+ // ignore: prefer_const_declarations
+ final $response =
+ $types[0].decode($decoder, $fidl.kMessageHeaderSize);
+
+ $completer.complete($response);
+
+ // ignore: avoid_catches_without_on_clauses
+ } catch (_e) {
+ ctrl.proxyError($fidl.FidlError(
+ 'Exception handling method response $_name: $_e'));
+ ctrl.close();
+ rethrow;
+ } finally {
+ Timeline.finishSync();
+ }
+ break;
+ default:
+ ctrl.proxyError(
+ $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
+ ctrl.close();
+ break;
+ }
+ }
+
+ @override
+ $async.Future<StrictBoundedXUnion>
+ strictXUnionHenceResponseMayBeStackAllocated() async {
+ if (!ctrl.isBound) {
+ return $async.Future.error(
+ $fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'),
+ StackTrace.current);
+ }
+
+ final $fidl.Encoder $encoder = $fidl.Encoder();
+ $encoder.encodeMessageHeader(
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal,
+ 0);
+ final $completer = $async.Completer<StrictBoundedXUnion>();
+ ctrl.sendMessageWithResponse($encoder.message, $completer);
+ return $completer.future;
+ }
+
+ @override
+ $async.Future<OlderSimpleUnion>
+ flexibleXUnionHenceResponseMustBeHeapAllocated() async {
+ if (!ctrl.isBound) {
+ return $async.Future.error(
+ $fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'),
+ StackTrace.current);
+ }
+
+ final $fidl.Encoder $encoder = $fidl.Encoder();
+ $encoder.encodeMessageHeader(
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal,
+ 0);
+ final $completer = $async.Completer<OlderSimpleUnion>();
+ ctrl.sendMessageWithResponse($encoder.message, $completer);
+ return $completer.future;
+ }
+}
+
+class TestProtocolBinding extends $fidl.AsyncBinding<TestProtocol> {
+ TestProtocolBinding() : super(r"TestProtocol");
+
+ @override
+ void handleMessage($fidl.Message $message, $fidl.MessageSink $respond) {
+ final $fidl.Decoder $decoder = $fidl.Decoder($message)
+ ..claimMemory($fidl.kMessageHeaderSize);
+ switch ($message.ordinal) {
+ case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal:
+ case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal:
+ final String _name =
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
+ .name;
+ try {
+ Timeline.startSync(_name);
+ final List<$fidl.MemberType> $types =
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
+ .request;
+ $decoder.claimMemory(
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
+ .decodeRequestInlineSize($decoder));
+ final $async.Future<StrictBoundedXUnion> $future =
+ impl.strictXUnionHenceResponseMayBeStackAllocated();
+ $future.then(($response) {
+ final $fidl.Encoder $encoder = $fidl.Encoder();
+ $encoder.encodeMessageHeader(
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal,
+ $message.txid);
+ $encoder.alloc(
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
+ .encodingResponseInlineSize($encoder));
+ final List<$fidl.MemberType> $types =
+ _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
+ .response;
+ $types[0].encode($encoder, $response, $fidl.kMessageHeaderSize);
+ $respond($encoder.message);
+ }, onError: (_e) {
+ close();
+ print('Exception handling method call $_name: $_e');
+ });
+ // ignore: avoid_catches_without_on_clauses
+ } catch (_e) {
+ close();
+ print('Exception handling method call $_name: $_e');
+ rethrow;
+ } finally {
+ Timeline.finishSync();
+ }
+ break;
+ case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal:
+ case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal:
+ final String _name =
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
+ .name;
+ try {
+ Timeline.startSync(_name);
+ final List<$fidl.MemberType> $types =
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
+ .request;
+ $decoder.claimMemory(
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
+ .decodeRequestInlineSize($decoder));
+ final $async.Future<OlderSimpleUnion> $future =
+ impl.flexibleXUnionHenceResponseMustBeHeapAllocated();
+ $future.then(($response) {
+ final $fidl.Encoder $encoder = $fidl.Encoder();
+ $encoder.encodeMessageHeader(
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal,
+ $message.txid);
+ $encoder.alloc(
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
+ .encodingResponseInlineSize($encoder));
+ final List<$fidl.MemberType> $types =
+ _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
+ .response;
+ $types[0].encode($encoder, $response, $fidl.kMessageHeaderSize);
+ $respond($encoder.message);
+ }, onError: (_e) {
+ close();
+ print('Exception handling method call $_name: $_e');
+ });
+ // ignore: avoid_catches_without_on_clauses
+ } catch (_e) {
+ close();
+ print('Exception handling method call $_name: $_e');
+ rethrow;
+ } finally {
+ Timeline.finishSync();
+ }
+ break;
+ default:
+ throw $fidl.FidlError(
+ r'Unexpected message name for TestProtocolBinding');
+ }
+ }
+}
diff --git a/bin/fidlgen_dart/goldens/union.test.json_test.dart.golden b/bin/fidlgen_dart/goldens/union.test.json_test.dart.golden
index 20fde40..fae2630 100644
--- a/bin/fidlgen_dart/goldens/union.test.json_test.dart.golden
+++ b/bin/fidlgen_dart/goldens/union.test.json_test.dart.golden
@@ -19,3 +19,17 @@
// ignore_for_file: unused_import
// ignore_for_file: library_prefixes
// ignore_for_file: unused_shown_name
+
+class TestProtocol$TestBase extends TestProtocol {
+ @override
+ $async.Future<StrictBoundedXUnion>
+ strictXUnionHenceResponseMayBeStackAllocated() {
+ return $async.Future.error(UnimplementedError());
+ }
+
+ @override
+ $async.Future<OlderSimpleUnion>
+ flexibleXUnionHenceResponseMustBeHeapAllocated() {
+ return $async.Future.error(UnimplementedError());
+ }
+}
diff --git a/bin/fidlgen_dart/goldens/union_sandwich.test.json b/bin/fidlgen_dart/goldens/union_sandwich.test.json
index 6394549..ee86e72 100644
--- a/bin/fidlgen_dart/goldens/union_sandwich.test.json
+++ b/bin/fidlgen_dart/goldens/union_sandwich.test.json
@@ -349,7 +349,7 @@
"location": {
"filename": "union_sandwich.test.fidl",
"line": 10,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -384,7 +384,7 @@
"location": {
"filename": "union_sandwich.test.fidl",
"line": 20,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -423,7 +423,7 @@
"location": {
"filename": "union_sandwich.test.fidl",
"line": 35,
- "column": 14
+ "column": 7
},
"members": [
{
@@ -459,7 +459,7 @@
"location": {
"filename": "union_sandwich.test.fidl",
"line": 45,
- "column": 14
+ "column": 7
},
"members": [
{
diff --git a/bin/fidlgen_dart/goldens/xunion.test.json b/bin/fidlgen_dart/goldens/xunion.test.json
deleted file mode 100644
index 1c388db..0000000
--- a/bin/fidlgen_dart/goldens/xunion.test.json
+++ /dev/null
@@ -1,839 +0,0 @@
-{
- "version": "0.0.1",
- "name": "fidl.test.json",
- "library_dependencies": [],
- "bits_declarations": [],
- "const_declarations": [],
- "enum_declarations": [],
- "interface_declarations": [
- {
- "name": "fidl.test.json/TestProtocol",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 60,
- "column": 10
- },
- "methods": [
- {
- "ordinal": 7548006651618394112,
- "generated_ordinal": 8255078252057434586,
- "name": "StrictXUnionHenceResponseMayBeStackAllocated",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 61,
- "column": 5
- },
- "has_request": true,
- "maybe_request": [],
- "maybe_request_type_shape_v1": {
- "inline_size": 16,
- "alignment": 8,
- "depth": 0,
- "max_handles": 0,
- "max_out_of_line": 0,
- "has_padding": false,
- "has_flexible_envelope": false,
- "contains_union": false
- },
- "has_response": true,
- "maybe_response": [
- {
- "type": {
- "kind": "identifier",
- "identifier": "fidl.test.json/StrictBoundedXUnion",
- "nullable": false
- },
- "name": "xu",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 61,
- "column": 76
- },
- "field_shape_v1": {
- "offset": 16,
- "padding": 0
- }
- }
- ],
- "maybe_response_payload": "fidl.test.json/SomeLongAnonymousPrefix1",
- "maybe_response_type_shape_v1": {
- "inline_size": 40,
- "alignment": 8,
- "depth": 2,
- "max_handles": 0,
- "max_out_of_line": 32,
- "has_padding": true,
- "has_flexible_envelope": false,
- "contains_union": true
- },
- "is_composed": false
- },
- {
- "ordinal": 1688296084360658944,
- "generated_ordinal": 1140178169303334883,
- "name": "FlexibleXUnionHenceResponseMustBeHeapAllocated",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 62,
- "column": 5
- },
- "has_request": true,
- "maybe_request": [],
- "maybe_request_type_shape_v1": {
- "inline_size": 16,
- "alignment": 8,
- "depth": 0,
- "max_handles": 0,
- "max_out_of_line": 0,
- "has_padding": false,
- "has_flexible_envelope": false,
- "contains_union": false
- },
- "has_response": true,
- "maybe_response": [
- {
- "type": {
- "kind": "identifier",
- "identifier": "fidl.test.json/OlderSimpleUnion",
- "nullable": false
- },
- "name": "xu",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 62,
- "column": 75
- },
- "field_shape_v1": {
- "offset": 16,
- "padding": 0
- }
- }
- ],
- "maybe_response_payload": "fidl.test.json/SomeLongAnonymousPrefix3",
- "maybe_response_type_shape_v1": {
- "inline_size": 40,
- "alignment": 8,
- "depth": 1,
- "max_handles": 0,
- "max_out_of_line": 8,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- },
- "is_composed": false
- }
- ]
- }
- ],
- "service_declarations": [],
- "struct_declarations": [
- {
- "name": "fidl.test.json/SomeLongAnonymousPrefix1",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 61,
- "column": 55
- },
- "anonymous": true,
- "members": [
- {
- "type": {
- "kind": "identifier",
- "identifier": "fidl.test.json/StrictBoundedXUnion",
- "nullable": false
- },
- "name": "xu",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 61,
- "column": 76
- },
- "field_shape_v1": {
- "offset": 0,
- "padding": 0
- }
- }
- ],
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 2,
- "max_handles": 0,
- "max_out_of_line": 32,
- "has_padding": true,
- "has_flexible_envelope": false,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/SomeLongAnonymousPrefix3",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 62,
- "column": 57
- },
- "anonymous": true,
- "members": [
- {
- "type": {
- "kind": "identifier",
- "identifier": "fidl.test.json/OlderSimpleUnion",
- "nullable": false
- },
- "name": "xu",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 62,
- "column": 75
- },
- "field_shape_v1": {
- "offset": 0,
- "padding": 0
- }
- }
- ],
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 1,
- "max_handles": 0,
- "max_out_of_line": 8,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/Empty",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 47,
- "column": 8
- },
- "anonymous": false,
- "members": [],
- "type_shape_v1": {
- "inline_size": 1,
- "alignment": 1,
- "depth": 0,
- "max_handles": 0,
- "max_out_of_line": 0,
- "has_padding": false,
- "has_flexible_envelope": false,
- "contains_union": false
- }
- },
- {
- "name": "fidl.test.json/StructWithNullableXUnion",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 65,
- "column": 8
- },
- "anonymous": false,
- "members": [
- {
- "type": {
- "kind": "identifier",
- "identifier": "fidl.test.json/OlderSimpleUnion",
- "nullable": true
- },
- "name": "x1",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 66,
- "column": 23
- },
- "field_shape_v1": {
- "offset": 0,
- "padding": 0
- }
- }
- ],
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 1,
- "max_handles": 0,
- "max_out_of_line": 8,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- }
- }
- ],
- "table_declarations": [],
- "union_declarations": [
- {
- "name": "fidl.test.json/FlexibleFoo",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 3,
- "column": 16
- },
- "members": [
- {
- "ordinal": 1,
- "reserved": false,
- "name": "s",
- "type": {
- "kind": "string",
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 4,
- "column": 15
- }
- },
- {
- "ordinal": 2,
- "reserved": false,
- "name": "i",
- "type": {
- "kind": "primitive",
- "subtype": "int32"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 5,
- "column": 14
- }
- }
- ],
- "strict": false,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 2,
- "max_handles": 0,
- "max_out_of_line": 4294967295,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/StrictFoo",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 8,
- "column": 14
- },
- "members": [
- {
- "ordinal": 1,
- "reserved": false,
- "name": "s",
- "type": {
- "kind": "string",
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 9,
- "column": 15
- }
- },
- {
- "ordinal": 2,
- "reserved": false,
- "name": "i",
- "type": {
- "kind": "primitive",
- "subtype": "int32"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 10,
- "column": 14
- }
- }
- ],
- "strict": true,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 2,
- "max_handles": 0,
- "max_out_of_line": 4294967295,
- "has_padding": true,
- "has_flexible_envelope": false,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/ExplicitFoo",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 13,
- "column": 16
- },
- "members": [
- {
- "ordinal": 2,
- "reserved": false,
- "name": "s",
- "type": {
- "kind": "string",
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 14,
- "column": 15
- }
- },
- {
- "ordinal": 1,
- "reserved": false,
- "name": "i",
- "type": {
- "kind": "primitive",
- "subtype": "int32"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 15,
- "column": 14
- }
- },
- {
- "ordinal": 3,
- "reserved": true,
- "location": {
- "filename": "xunion.test.fidl",
- "line": 16,
- "column": 5
- }
- }
- ],
- "strict": false,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 2,
- "max_handles": 0,
- "max_out_of_line": 4294967295,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/ExplicitStrictFoo",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 19,
- "column": 14
- },
- "members": [
- {
- "ordinal": 1,
- "reserved": true,
- "location": {
- "filename": "xunion.test.fidl",
- "line": 20,
- "column": 5
- }
- },
- {
- "ordinal": 3,
- "reserved": false,
- "name": "s",
- "type": {
- "kind": "string",
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 21,
- "column": 15
- }
- },
- {
- "ordinal": 2,
- "reserved": false,
- "name": "i",
- "type": {
- "kind": "primitive",
- "subtype": "int32"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 22,
- "column": 14
- }
- }
- ],
- "strict": true,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 2,
- "max_handles": 0,
- "max_out_of_line": 4294967295,
- "has_padding": true,
- "has_flexible_envelope": false,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/OlderSimpleUnion",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 25,
- "column": 16
- },
- "members": [
- {
- "ordinal": 1,
- "reserved": false,
- "name": "i",
- "type": {
- "kind": "primitive",
- "subtype": "int64"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 26,
- "column": 14
- }
- },
- {
- "ordinal": 2,
- "reserved": false,
- "name": "f",
- "type": {
- "kind": "primitive",
- "subtype": "float32"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 27,
- "column": 16
- }
- }
- ],
- "strict": false,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 1,
- "max_handles": 0,
- "max_out_of_line": 8,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/NewerSimpleUnion",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 30,
- "column": 16
- },
- "members": [
- {
- "ordinal": 1,
- "reserved": false,
- "name": "i",
- "type": {
- "kind": "primitive",
- "subtype": "int64"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 33,
- "column": 14
- }
- },
- {
- "ordinal": 2,
- "reserved": false,
- "name": "s",
- "type": {
- "kind": "string",
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 35,
- "column": 15
- }
- },
- {
- "ordinal": 3,
- "reserved": false,
- "name": "v",
- "type": {
- "kind": "vector",
- "element_type": {
- "kind": "string",
- "nullable": false
- },
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 36,
- "column": 23
- }
- }
- ],
- "strict": false,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 3,
- "max_handles": 0,
- "max_out_of_line": 4294967295,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/StrictSimpleXUnion",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 41,
- "column": 14
- },
- "members": [
- {
- "ordinal": 1,
- "reserved": false,
- "name": "i",
- "type": {
- "kind": "primitive",
- "subtype": "int32"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 42,
- "column": 14
- }
- },
- {
- "ordinal": 2,
- "reserved": false,
- "name": "f",
- "type": {
- "kind": "primitive",
- "subtype": "float32"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 43,
- "column": 16
- }
- },
- {
- "ordinal": 3,
- "reserved": false,
- "name": "s",
- "type": {
- "kind": "string",
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 44,
- "column": 15
- }
- }
- ],
- "strict": true,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 2,
- "max_handles": 0,
- "max_out_of_line": 4294967295,
- "has_padding": true,
- "has_flexible_envelope": false,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/XUnionContainingEmptyStruct",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 50,
- "column": 16
- },
- "members": [
- {
- "ordinal": 1,
- "reserved": false,
- "name": "empty",
- "type": {
- "kind": "identifier",
- "identifier": "fidl.test.json/Empty",
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 53,
- "column": 14
- }
- }
- ],
- "strict": false,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 1,
- "max_handles": 0,
- "max_out_of_line": 8,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/StrictBoundedXUnion",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 56,
- "column": 14
- },
- "members": [
- {
- "ordinal": 1,
- "reserved": false,
- "name": "v",
- "type": {
- "kind": "vector",
- "element_type": {
- "kind": "primitive",
- "subtype": "uint8"
- },
- "maybe_element_count": 10,
- "nullable": false
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 57,
- "column": 25
- }
- }
- ],
- "strict": true,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 2,
- "max_handles": 0,
- "max_out_of_line": 32,
- "has_padding": true,
- "has_flexible_envelope": false,
- "contains_union": true
- }
- },
- {
- "name": "fidl.test.json/ExplicitXUnion",
- "location": {
- "filename": "xunion.test.fidl",
- "line": 69,
- "column": 16
- },
- "members": [
- {
- "ordinal": 3,
- "reserved": true,
- "location": {
- "filename": "xunion.test.fidl",
- "line": 70,
- "column": 5
- }
- },
- {
- "ordinal": 2,
- "reserved": true,
- "location": {
- "filename": "xunion.test.fidl",
- "line": 71,
- "column": 5
- }
- },
- {
- "ordinal": 1,
- "reserved": false,
- "name": "i",
- "type": {
- "kind": "primitive",
- "subtype": "int64"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 72,
- "column": 14
- }
- },
- {
- "ordinal": 4,
- "reserved": false,
- "name": "f",
- "type": {
- "kind": "primitive",
- "subtype": "float32"
- },
- "location": {
- "filename": "xunion.test.fidl",
- "line": 73,
- "column": 16
- }
- }
- ],
- "strict": false,
- "type_shape_v1": {
- "inline_size": 24,
- "alignment": 8,
- "depth": 1,
- "max_handles": 0,
- "max_out_of_line": 8,
- "has_padding": true,
- "has_flexible_envelope": true,
- "contains_union": true
- }
- }
- ],
- "type_alias_declarations": [],
- "declaration_order": [
- "fidl.test.json/StructWithNullableXUnion",
- "fidl.test.json/StrictSimpleXUnion",
- "fidl.test.json/StrictFoo",
- "fidl.test.json/StrictBoundedXUnion",
- "fidl.test.json/OlderSimpleUnion",
- "fidl.test.json/TestProtocol",
- "fidl.test.json/NewerSimpleUnion",
- "fidl.test.json/FlexibleFoo",
- "fidl.test.json/ExplicitXUnion",
- "fidl.test.json/ExplicitStrictFoo",
- "fidl.test.json/ExplicitFoo",
- "fidl.test.json/Empty",
- "fidl.test.json/XUnionContainingEmptyStruct"
- ],
- "declarations": {
- "fidl.test.json/TestProtocol": "interface",
- "fidl.test.json/SomeLongAnonymousPrefix0": "struct",
- "fidl.test.json/SomeLongAnonymousPrefix1": "struct",
- "fidl.test.json/SomeLongAnonymousPrefix2": "struct",
- "fidl.test.json/SomeLongAnonymousPrefix3": "struct",
- "fidl.test.json/Empty": "struct",
- "fidl.test.json/StructWithNullableXUnion": "struct",
- "fidl.test.json/FlexibleFoo": "union",
- "fidl.test.json/StrictFoo": "union",
- "fidl.test.json/ExplicitFoo": "union",
- "fidl.test.json/ExplicitStrictFoo": "union",
- "fidl.test.json/OlderSimpleUnion": "union",
- "fidl.test.json/NewerSimpleUnion": "union",
- "fidl.test.json/StrictSimpleXUnion": "union",
- "fidl.test.json/XUnionContainingEmptyStruct": "union",
- "fidl.test.json/StrictBoundedXUnion": "union",
- "fidl.test.json/ExplicitXUnion": "union"
- }
-}
diff --git a/bin/fidlgen_dart/goldens/xunion.test.json_async.dart.golden b/bin/fidlgen_dart/goldens/xunion.test.json_async.dart.golden
deleted file mode 100644
index 243ffa2..0000000
--- a/bin/fidlgen_dart/goldens/xunion.test.json_async.dart.golden
+++ /dev/null
@@ -1,1363 +0,0 @@
-// WARNING: This file is machine generated by fidlgen.
-
-library fidl_fidl_test_json_async;
-
-import 'dart:async' as $async;
-import 'dart:core' hide Set;
-import 'dart:developer';
-import 'dart:typed_data';
-
-import 'package:fidl/fidl.dart' as $fidl;
-import 'package:meta/meta.dart';
-import 'package:zircon/zircon.dart' as $zx;
-
-// ignore_for_file: always_specify_types
-// ignore_for_file: avoid_positional_boolean_parameters
-// ignore_for_file: avoid_returning_null
-// ignore_for_file: cascade_invocations
-// ignore_for_file: constant_identifier_names
-// ignore_for_file: one_member_abstracts
-// ignore_for_file: prefer_constructors_over_static_methods
-// ignore_for_file: prefer_single_quotes
-// ignore_for_file: public_member_api_docs
-// ignore_for_file: unused_import
-// ignore_for_file: unused_local_variable
-// ignore_for_file: non_constant_identifier_names
-// ignore_for_file: library_prefixes
-// ignore_for_file: prefer_typing_uninitialized_variables
-// ignore_for_file: avoid_js_rounded_ints
-// ignore_for_file: unnecessary_parenthesis
-// ignore_for_file: always_put_required_named_parameters_first
-// ignore_for_file: prefer_generic_function_type_aliases
-// ignore_for_file: prefer_equal_for_default_values
-// ignore_for_file: avoid_catches_without_on_clauses
-// ignore_for_file: unused_shown_name
-// ignore_for_file: unnecessary_lambdas
-// ignore_for_file: comment_references
-// ignore_for_file: avoid_unused_constructor_parameters
-
-enum FlexibleFooTag {
- $unknown,
- s, // 0x1
- i, // 0x2
-}
-
-const Map<int, FlexibleFooTag> _FlexibleFooTag_map = {
- 1: FlexibleFooTag.s,
- 2: FlexibleFooTag.i,
-};
-
-class FlexibleFoo extends $fidl.XUnion {
- const FlexibleFoo.withS(String value)
- : _ordinal = 1,
- _data = value;
-
- const FlexibleFoo.withI(int value)
- : _ordinal = 2,
- _data = value;
-
- FlexibleFoo._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- FlexibleFooTag get $tag {
- final FlexibleFooTag $rawtag = _FlexibleFooTag_map[_ordinal];
- return $rawtag == null ? FlexibleFooTag.$unknown : $rawtag;
- }
-
- String get s {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- int get i {
- if (_ordinal != 2) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 1:
- return 'FlexibleFoo.s($s)';
- case 2:
- return 'FlexibleFoo.i($i)';
- default:
- return 'FlexibleFoo.<UNKNOWN>';
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static FlexibleFoo _ctor(int ordinal, Object data) {
- return FlexibleFoo._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<FlexibleFoo> kFlexibleFoo_Type =
- $fidl.XUnionType<FlexibleFoo>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.StringType(maybeElementCount: null, nullable: false),
- 2: $fidl.Int32Type(),
- },
- ctor: FlexibleFoo._ctor,
- nullable: false,
- flexible: true,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<FlexibleFoo> kFlexibleFoo_OptType =
- $fidl.XUnionType<FlexibleFoo>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.StringType(maybeElementCount: null, nullable: false),
- 2: $fidl.Int32Type(),
- },
- ctor: FlexibleFoo._ctor,
- nullable: true,
- flexible: true,
-);
-
-enum StrictFooTag {
- s, // 0x1
- i, // 0x2
-}
-
-const Map<int, StrictFooTag> _StrictFooTag_map = {
- 1: StrictFooTag.s,
- 2: StrictFooTag.i,
-};
-
-class StrictFoo extends $fidl.XUnion {
- const StrictFoo.withS(String value)
- : _ordinal = 1,
- _data = value;
-
- const StrictFoo.withI(int value)
- : _ordinal = 2,
- _data = value;
-
- StrictFoo._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- StrictFooTag get $tag => _StrictFooTag_map[_ordinal];
-
- String get s {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- int get i {
- if (_ordinal != 2) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 1:
- return 'StrictFoo.s($s)';
- case 2:
- return 'StrictFoo.i($i)';
- default:
- return null;
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static StrictFoo _ctor(int ordinal, Object data) {
- return StrictFoo._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<StrictFoo> kStrictFoo_Type = $fidl.XUnionType<StrictFoo>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.StringType(maybeElementCount: null, nullable: false),
- 2: $fidl.Int32Type(),
- },
- ctor: StrictFoo._ctor,
- nullable: false,
- flexible: false,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<StrictFoo> kStrictFoo_OptType =
- $fidl.XUnionType<StrictFoo>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.StringType(maybeElementCount: null, nullable: false),
- 2: $fidl.Int32Type(),
- },
- ctor: StrictFoo._ctor,
- nullable: true,
- flexible: false,
-);
-
-enum ExplicitFooTag {
- $unknown,
- s, // 0x2
- i, // 0x1
-}
-
-const Map<int, ExplicitFooTag> _ExplicitFooTag_map = {
- 2: ExplicitFooTag.s,
- 1: ExplicitFooTag.i,
-};
-
-class ExplicitFoo extends $fidl.XUnion {
- const ExplicitFoo.withS(String value)
- : _ordinal = 2,
- _data = value;
-
- const ExplicitFoo.withI(int value)
- : _ordinal = 1,
- _data = value;
-
- ExplicitFoo._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- ExplicitFooTag get $tag {
- final ExplicitFooTag $rawtag = _ExplicitFooTag_map[_ordinal];
- return $rawtag == null ? ExplicitFooTag.$unknown : $rawtag;
- }
-
- String get s {
- if (_ordinal != 2) {
- return null;
- }
- return _data;
- }
-
- int get i {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 2:
- return 'ExplicitFoo.s($s)';
- case 1:
- return 'ExplicitFoo.i($i)';
- default:
- return 'ExplicitFoo.<UNKNOWN>';
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static ExplicitFoo _ctor(int ordinal, Object data) {
- return ExplicitFoo._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<ExplicitFoo> kExplicitFoo_Type =
- $fidl.XUnionType<ExplicitFoo>(
- members: <int, $fidl.FidlType>{
- 2: $fidl.StringType(maybeElementCount: null, nullable: false),
- 1: $fidl.Int32Type(),
- },
- ctor: ExplicitFoo._ctor,
- nullable: false,
- flexible: true,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<ExplicitFoo> kExplicitFoo_OptType =
- $fidl.XUnionType<ExplicitFoo>(
- members: <int, $fidl.FidlType>{
- 2: $fidl.StringType(maybeElementCount: null, nullable: false),
- 1: $fidl.Int32Type(),
- },
- ctor: ExplicitFoo._ctor,
- nullable: true,
- flexible: true,
-);
-
-enum ExplicitStrictFooTag {
- s, // 0x3
- i, // 0x2
-}
-
-const Map<int, ExplicitStrictFooTag> _ExplicitStrictFooTag_map = {
- 3: ExplicitStrictFooTag.s,
- 2: ExplicitStrictFooTag.i,
-};
-
-class ExplicitStrictFoo extends $fidl.XUnion {
- const ExplicitStrictFoo.withS(String value)
- : _ordinal = 3,
- _data = value;
-
- const ExplicitStrictFoo.withI(int value)
- : _ordinal = 2,
- _data = value;
-
- ExplicitStrictFoo._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- ExplicitStrictFooTag get $tag => _ExplicitStrictFooTag_map[_ordinal];
-
- String get s {
- if (_ordinal != 3) {
- return null;
- }
- return _data;
- }
-
- int get i {
- if (_ordinal != 2) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 3:
- return 'ExplicitStrictFoo.s($s)';
- case 2:
- return 'ExplicitStrictFoo.i($i)';
- default:
- return null;
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static ExplicitStrictFoo _ctor(int ordinal, Object data) {
- return ExplicitStrictFoo._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<ExplicitStrictFoo> kExplicitStrictFoo_Type =
- $fidl.XUnionType<ExplicitStrictFoo>(
- members: <int, $fidl.FidlType>{
- 3: $fidl.StringType(maybeElementCount: null, nullable: false),
- 2: $fidl.Int32Type(),
- },
- ctor: ExplicitStrictFoo._ctor,
- nullable: false,
- flexible: false,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<ExplicitStrictFoo> kExplicitStrictFoo_OptType =
- $fidl.XUnionType<ExplicitStrictFoo>(
- members: <int, $fidl.FidlType>{
- 3: $fidl.StringType(maybeElementCount: null, nullable: false),
- 2: $fidl.Int32Type(),
- },
- ctor: ExplicitStrictFoo._ctor,
- nullable: true,
- flexible: false,
-);
-
-enum OlderSimpleUnionTag {
- $unknown,
- i, // 0x1
- f, // 0x2
-}
-
-const Map<int, OlderSimpleUnionTag> _OlderSimpleUnionTag_map = {
- 1: OlderSimpleUnionTag.i,
- 2: OlderSimpleUnionTag.f,
-};
-
-class OlderSimpleUnion extends $fidl.XUnion {
- const OlderSimpleUnion.withI(int value)
- : _ordinal = 1,
- _data = value;
-
- const OlderSimpleUnion.withF(double value)
- : _ordinal = 2,
- _data = value;
-
- OlderSimpleUnion._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- OlderSimpleUnionTag get $tag {
- final OlderSimpleUnionTag $rawtag = _OlderSimpleUnionTag_map[_ordinal];
- return $rawtag == null ? OlderSimpleUnionTag.$unknown : $rawtag;
- }
-
- int get i {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- double get f {
- if (_ordinal != 2) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 1:
- return 'OlderSimpleUnion.i($i)';
- case 2:
- return 'OlderSimpleUnion.f($f)';
- default:
- return 'OlderSimpleUnion.<UNKNOWN>';
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static OlderSimpleUnion _ctor(int ordinal, Object data) {
- return OlderSimpleUnion._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<OlderSimpleUnion> kOlderSimpleUnion_Type =
- $fidl.XUnionType<OlderSimpleUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.Int64Type(),
- 2: $fidl.Float32Type(),
- },
- ctor: OlderSimpleUnion._ctor,
- nullable: false,
- flexible: true,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<OlderSimpleUnion> kOlderSimpleUnion_OptType =
- $fidl.XUnionType<OlderSimpleUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.Int64Type(),
- 2: $fidl.Float32Type(),
- },
- ctor: OlderSimpleUnion._ctor,
- nullable: true,
- flexible: true,
-);
-
-enum NewerSimpleUnionTag {
- $unknown,
- i, // 0x1
- s, // 0x2
- v, // 0x3
-}
-
-const Map<int, NewerSimpleUnionTag> _NewerSimpleUnionTag_map = {
- 1: NewerSimpleUnionTag.i,
- 2: NewerSimpleUnionTag.s,
- 3: NewerSimpleUnionTag.v,
-};
-
-class NewerSimpleUnion extends $fidl.XUnion {
- const NewerSimpleUnion.withI(int value)
- : _ordinal = 1,
- _data = value;
-
- const NewerSimpleUnion.withS(String value)
- : _ordinal = 2,
- _data = value;
-
- const NewerSimpleUnion.withV(List<String> value)
- : _ordinal = 3,
- _data = value;
-
- NewerSimpleUnion._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- NewerSimpleUnionTag get $tag {
- final NewerSimpleUnionTag $rawtag = _NewerSimpleUnionTag_map[_ordinal];
- return $rawtag == null ? NewerSimpleUnionTag.$unknown : $rawtag;
- }
-
- int get i {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- String get s {
- if (_ordinal != 2) {
- return null;
- }
- return _data;
- }
-
- List<String> get v {
- if (_ordinal != 3) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 1:
- return 'NewerSimpleUnion.i($i)';
- case 2:
- return 'NewerSimpleUnion.s($s)';
- case 3:
- return 'NewerSimpleUnion.v($v)';
- default:
- return 'NewerSimpleUnion.<UNKNOWN>';
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static NewerSimpleUnion _ctor(int ordinal, Object data) {
- return NewerSimpleUnion._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<NewerSimpleUnion> kNewerSimpleUnion_Type =
- $fidl.XUnionType<NewerSimpleUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.Int64Type(),
- 2: $fidl.StringType(maybeElementCount: null, nullable: false),
- 3: $fidl.VectorType<List<String>>(
- element: $fidl.StringType(maybeElementCount: null, nullable: false),
- maybeElementCount: null,
- nullable: false),
- },
- ctor: NewerSimpleUnion._ctor,
- nullable: false,
- flexible: true,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<NewerSimpleUnion> kNewerSimpleUnion_OptType =
- $fidl.XUnionType<NewerSimpleUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.Int64Type(),
- 2: $fidl.StringType(maybeElementCount: null, nullable: false),
- 3: $fidl.VectorType<List<String>>(
- element: $fidl.StringType(maybeElementCount: null, nullable: false),
- maybeElementCount: null,
- nullable: false),
- },
- ctor: NewerSimpleUnion._ctor,
- nullable: true,
- flexible: true,
-);
-
-enum StrictSimpleXUnionTag {
- i, // 0x1
- f, // 0x2
- s, // 0x3
-}
-
-const Map<int, StrictSimpleXUnionTag> _StrictSimpleXUnionTag_map = {
- 1: StrictSimpleXUnionTag.i,
- 2: StrictSimpleXUnionTag.f,
- 3: StrictSimpleXUnionTag.s,
-};
-
-class StrictSimpleXUnion extends $fidl.XUnion {
- const StrictSimpleXUnion.withI(int value)
- : _ordinal = 1,
- _data = value;
-
- const StrictSimpleXUnion.withF(double value)
- : _ordinal = 2,
- _data = value;
-
- const StrictSimpleXUnion.withS(String value)
- : _ordinal = 3,
- _data = value;
-
- StrictSimpleXUnion._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- StrictSimpleXUnionTag get $tag => _StrictSimpleXUnionTag_map[_ordinal];
-
- int get i {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- double get f {
- if (_ordinal != 2) {
- return null;
- }
- return _data;
- }
-
- String get s {
- if (_ordinal != 3) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 1:
- return 'StrictSimpleXUnion.i($i)';
- case 2:
- return 'StrictSimpleXUnion.f($f)';
- case 3:
- return 'StrictSimpleXUnion.s($s)';
- default:
- return null;
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static StrictSimpleXUnion _ctor(int ordinal, Object data) {
- return StrictSimpleXUnion._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<StrictSimpleXUnion> kStrictSimpleXUnion_Type =
- $fidl.XUnionType<StrictSimpleXUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.Int32Type(),
- 2: $fidl.Float32Type(),
- 3: $fidl.StringType(maybeElementCount: null, nullable: false),
- },
- ctor: StrictSimpleXUnion._ctor,
- nullable: false,
- flexible: false,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<StrictSimpleXUnion> kStrictSimpleXUnion_OptType =
- $fidl.XUnionType<StrictSimpleXUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.Int32Type(),
- 2: $fidl.Float32Type(),
- 3: $fidl.StringType(maybeElementCount: null, nullable: false),
- },
- ctor: StrictSimpleXUnion._ctor,
- nullable: true,
- flexible: false,
-);
-
-enum XUnionContainingEmptyStructTag {
- $unknown,
- empty, // 0x1
-}
-
-const Map<int, XUnionContainingEmptyStructTag>
- _XUnionContainingEmptyStructTag_map = {
- 1: XUnionContainingEmptyStructTag.empty,
-};
-
-class XUnionContainingEmptyStruct extends $fidl.XUnion {
- const XUnionContainingEmptyStruct.withEmpty(Empty value)
- : _ordinal = 1,
- _data = value;
-
- XUnionContainingEmptyStruct._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- XUnionContainingEmptyStructTag get $tag {
- final XUnionContainingEmptyStructTag $rawtag =
- _XUnionContainingEmptyStructTag_map[_ordinal];
- return $rawtag == null ? XUnionContainingEmptyStructTag.$unknown : $rawtag;
- }
-
- Empty get empty {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 1:
- return 'XUnionContainingEmptyStruct.empty($empty)';
- default:
- return 'XUnionContainingEmptyStruct.<UNKNOWN>';
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static XUnionContainingEmptyStruct _ctor(int ordinal, Object data) {
- return XUnionContainingEmptyStruct._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<XUnionContainingEmptyStruct>
- kXUnionContainingEmptyStruct_Type =
- $fidl.XUnionType<XUnionContainingEmptyStruct>(
- members: <int, $fidl.FidlType>{
- 1: kEmpty_Type,
- },
- ctor: XUnionContainingEmptyStruct._ctor,
- nullable: false,
- flexible: true,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<XUnionContainingEmptyStruct>
- kXUnionContainingEmptyStruct_OptType =
- $fidl.XUnionType<XUnionContainingEmptyStruct>(
- members: <int, $fidl.FidlType>{
- 1: kEmpty_Type,
- },
- ctor: XUnionContainingEmptyStruct._ctor,
- nullable: true,
- flexible: true,
-);
-
-enum StrictBoundedXUnionTag {
- v, // 0x1
-}
-
-const Map<int, StrictBoundedXUnionTag> _StrictBoundedXUnionTag_map = {
- 1: StrictBoundedXUnionTag.v,
-};
-
-class StrictBoundedXUnion extends $fidl.XUnion {
- const StrictBoundedXUnion.withV(Uint8List value)
- : _ordinal = 1,
- _data = value;
-
- StrictBoundedXUnion._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- StrictBoundedXUnionTag get $tag => _StrictBoundedXUnionTag_map[_ordinal];
-
- Uint8List get v {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 1:
- return 'StrictBoundedXUnion.v($v)';
- default:
- return null;
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static StrictBoundedXUnion _ctor(int ordinal, Object data) {
- return StrictBoundedXUnion._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<StrictBoundedXUnion> kStrictBoundedXUnion_Type =
- $fidl.XUnionType<StrictBoundedXUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.VectorType<Uint8List>(
- element: $fidl.Uint8Type(), maybeElementCount: 10, nullable: false),
- },
- ctor: StrictBoundedXUnion._ctor,
- nullable: false,
- flexible: false,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<StrictBoundedXUnion> kStrictBoundedXUnion_OptType =
- $fidl.XUnionType<StrictBoundedXUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.VectorType<Uint8List>(
- element: $fidl.Uint8Type(), maybeElementCount: 10, nullable: false),
- },
- ctor: StrictBoundedXUnion._ctor,
- nullable: true,
- flexible: false,
-);
-
-enum ExplicitXUnionTag {
- $unknown,
- i, // 0x1
- f, // 0x4
-}
-
-const Map<int, ExplicitXUnionTag> _ExplicitXUnionTag_map = {
- 1: ExplicitXUnionTag.i,
- 4: ExplicitXUnionTag.f,
-};
-
-class ExplicitXUnion extends $fidl.XUnion {
- const ExplicitXUnion.withI(int value)
- : _ordinal = 1,
- _data = value;
-
- const ExplicitXUnion.withF(double value)
- : _ordinal = 4,
- _data = value;
-
- ExplicitXUnion._(int ordinal, Object data)
- : _ordinal = ordinal,
- _data = data;
-
- final int _ordinal;
- final _data;
-
- ExplicitXUnionTag get $tag {
- final ExplicitXUnionTag $rawtag = _ExplicitXUnionTag_map[_ordinal];
- return $rawtag == null ? ExplicitXUnionTag.$unknown : $rawtag;
- }
-
- int get i {
- if (_ordinal != 1) {
- return null;
- }
- return _data;
- }
-
- double get f {
- if (_ordinal != 4) {
- return null;
- }
- return _data;
- }
-
- @override
- String toString() {
- switch (_ordinal) {
- case 1:
- return 'ExplicitXUnion.i($i)';
- case 4:
- return 'ExplicitXUnion.f($f)';
- default:
- return 'ExplicitXUnion.<UNKNOWN>';
- }
- }
-
- @override
- int get $ordinal => _ordinal;
-
- @override
- Object get $data => _data;
-
- static ExplicitXUnion _ctor(int ordinal, Object data) {
- return ExplicitXUnion._(ordinal, data);
- }
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<ExplicitXUnion> kExplicitXUnion_Type =
- $fidl.XUnionType<ExplicitXUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.Int64Type(),
- 4: $fidl.Float32Type(),
- },
- ctor: ExplicitXUnion._ctor,
- nullable: false,
- flexible: true,
-);
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.XUnionType<ExplicitXUnion> kExplicitXUnion_OptType =
- $fidl.XUnionType<ExplicitXUnion>(
- members: <int, $fidl.FidlType>{
- 1: $fidl.Int64Type(),
- 4: $fidl.Float32Type(),
- },
- ctor: ExplicitXUnion._ctor,
- nullable: true,
- flexible: true,
-);
-
-class Empty extends $fidl.Struct {
- const Empty({
- this.reserved: 0x0,
- });
- Empty.clone(
- Empty $orig, {
- int reserved,
- }) : this(
- reserved: reserved ?? $orig.reserved,
- );
-
- Empty._(List<Object> argv) : reserved = argv[0];
- final int reserved;
-
- @override
- List<Object> get $fields {
- return <Object>[
- reserved,
- ];
- }
-
- @override
- String toString() {
- // ignore: prefer_interpolation_to_compose_strings
- return r'Empty' r'(reserved: ' + reserved.toString() + r')';
- }
-
- static Empty _ctor(List<Object> argv) => Empty._(argv);
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.StructType<Empty> kEmpty_Type = $fidl.StructType<Empty>(
- inlineSize: 1,
- members: <$fidl.MemberType>[
- $fidl.MemberType<int>(type: $fidl.Uint8Type(), offset: 0),
- ],
- ctor: Empty._ctor,
-);
-
-class StructWithNullableXUnion extends $fidl.Struct {
- const StructWithNullableXUnion({
- this.x1,
- });
- StructWithNullableXUnion.clone(
- StructWithNullableXUnion $orig, {
- OlderSimpleUnion x1,
- }) : this(
- x1: x1 ?? $orig.x1,
- );
-
- StructWithNullableXUnion.cloneWithout(
- StructWithNullableXUnion $orig, {
- bool x1,
- }) : this(
- x1: x1 ? null : $orig.x1,
- );
-
- StructWithNullableXUnion._(List<Object> argv) : x1 = argv[0];
- final OlderSimpleUnion x1;
-
- @override
- List<Object> get $fields {
- return <Object>[
- x1,
- ];
- }
-
- @override
- String toString() {
- // ignore: prefer_interpolation_to_compose_strings
- return r'StructWithNullableXUnion' r'(x1: ' + x1.toString() + r')';
- }
-
- static StructWithNullableXUnion _ctor(List<Object> argv) =>
- StructWithNullableXUnion._(argv);
-}
-
-// See FIDL-308:
-// ignore: recursive_compile_time_constant
-const $fidl.StructType<StructWithNullableXUnion>
- kStructWithNullableXUnion_Type = $fidl.StructType<StructWithNullableXUnion>(
- inlineSize: 24,
- members: <$fidl.MemberType>[
- $fidl.MemberType<OlderSimpleUnion>(
- type: kOlderSimpleUnion_OptType, offset: 0),
- ],
- ctor: StructWithNullableXUnion._ctor,
-);
-
-// ignore: unused_element, avoid_private_typedef_functions
-typedef _VoidCallback = void Function();
-
-// strictXUnionHenceResponseMayBeStackAllocated: () -> (StrictBoundedXUnion xu)
-const int _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal =
- 0x68bfe80f00000000;
-const int
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal =
- 0x728fedeed6ef99da;
-const $fidl.MethodType
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type =
- $fidl.MethodType(
- request: null,
- response: <$fidl.MemberType>[
- $fidl.MemberType<StrictBoundedXUnion>(
- type: kStrictBoundedXUnion_Type, offset: 0),
- ],
- name: r"TestProtocol.StrictXUnionHenceResponseMayBeStackAllocated",
- requestInlineSize: 0,
- responseInlineSize: 24,
-);
-// flexibleXUnionHenceResponseMustBeHeapAllocated: () -> (OlderSimpleUnion xu)
-const int
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal =
- 0x176e085800000000;
-const int
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal =
- 0xfd2ba0109faffe3;
-const $fidl.MethodType
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type =
- $fidl.MethodType(
- request: null,
- response: <$fidl.MemberType>[
- $fidl.MemberType<OlderSimpleUnion>(type: kOlderSimpleUnion_Type, offset: 0),
- ],
- name: r"TestProtocol.FlexibleXUnionHenceResponseMustBeHeapAllocated",
- requestInlineSize: 0,
- responseInlineSize: 24,
-);
-
-abstract class TestProtocol extends $fidl.Service {
- static const String $serviceName = null;
- @override
- $fidl.ServiceData get $serviceData => TestProtocolData();
- $async.Future<StrictBoundedXUnion>
- strictXUnionHenceResponseMayBeStackAllocated();
- $async.Future<OlderSimpleUnion>
- flexibleXUnionHenceResponseMustBeHeapAllocated();
-}
-
-class TestProtocolData implements $fidl.ServiceData<TestProtocol> {
- const TestProtocolData();
-
- @override
- String getName() {
- return TestProtocol.$serviceName;
- }
-
- @override
- $fidl.AsyncBinding getBinding() {
- return TestProtocolBinding();
- }
-}
-
-class TestProtocolProxy extends $fidl.AsyncProxy<TestProtocol>
- implements TestProtocol {
- TestProtocolProxy()
- : super($fidl.AsyncProxyController<TestProtocol>(
- $serviceName: null, $interfaceName: r'TestProtocol')) {
- ctrl.onResponse = _handleResponse;
- }
-
- @override
- $fidl.ServiceData get $serviceData => TestProtocolData();
-
- void _handleEvent($fidl.Message $message) {
- final $fidl.Decoder $decoder = $fidl.Decoder($message)
- ..claimMemory($fidl.kMessageHeaderSize);
- switch ($message.ordinal) {
- default:
- ctrl.proxyError(
- $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
- ctrl.close();
- break;
- }
- }
-
- void _handleResponse($fidl.Message $message) {
- final int $txid = $message.txid;
- if ($txid == 0) {
- _handleEvent($message);
- return;
- }
- final $async.Completer $completer = ctrl.getCompleter($txid);
- if ($completer == null) {
- $message.closeHandles();
- return;
- }
- final $fidl.Decoder $decoder = $fidl.Decoder($message)
- ..claimMemory($fidl.kMessageHeaderSize);
- switch ($message.ordinal) {
- case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal:
- case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal:
- final String _name =
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
- .name;
- try {
- Timeline.startSync(_name);
- final List<$fidl.MemberType> $types =
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
- .response;
- $decoder.claimMemory(
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
- .decodeResponseInlineSize($decoder));
- // ignore: prefer_const_declarations
- final $response =
- $types[0].decode($decoder, $fidl.kMessageHeaderSize);
-
- $completer.complete($response);
-
- // ignore: avoid_catches_without_on_clauses
- } catch (_e) {
- ctrl.proxyError($fidl.FidlError(
- 'Exception handling method response $_name: $_e'));
- ctrl.close();
- rethrow;
- } finally {
- Timeline.finishSync();
- }
- break;
- case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal:
- case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal:
- final String _name =
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
- .name;
- try {
- Timeline.startSync(_name);
- final List<$fidl.MemberType> $types =
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
- .response;
- $decoder.claimMemory(
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
- .decodeResponseInlineSize($decoder));
- // ignore: prefer_const_declarations
- final $response =
- $types[0].decode($decoder, $fidl.kMessageHeaderSize);
-
- $completer.complete($response);
-
- // ignore: avoid_catches_without_on_clauses
- } catch (_e) {
- ctrl.proxyError($fidl.FidlError(
- 'Exception handling method response $_name: $_e'));
- ctrl.close();
- rethrow;
- } finally {
- Timeline.finishSync();
- }
- break;
- default:
- ctrl.proxyError(
- $fidl.FidlError('Unexpected message ordinal: ${$message.ordinal}'));
- ctrl.close();
- break;
- }
- }
-
- @override
- $async.Future<StrictBoundedXUnion>
- strictXUnionHenceResponseMayBeStackAllocated() async {
- if (!ctrl.isBound) {
- return $async.Future.error(
- $fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'),
- StackTrace.current);
- }
-
- final $fidl.Encoder $encoder = $fidl.Encoder();
- $encoder.encodeMessageHeader(
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal,
- 0);
- final $completer = $async.Completer<StrictBoundedXUnion>();
- ctrl.sendMessageWithResponse($encoder.message, $completer);
- return $completer.future;
- }
-
- @override
- $async.Future<OlderSimpleUnion>
- flexibleXUnionHenceResponseMustBeHeapAllocated() async {
- if (!ctrl.isBound) {
- return $async.Future.error(
- $fidl.FidlStateException('Proxy<${ctrl.$interfaceName}> is closed.'),
- StackTrace.current);
- }
-
- final $fidl.Encoder $encoder = $fidl.Encoder();
- $encoder.encodeMessageHeader(
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal,
- 0);
- final $completer = $async.Completer<OlderSimpleUnion>();
- ctrl.sendMessageWithResponse($encoder.message, $completer);
- return $completer.future;
- }
-}
-
-class TestProtocolBinding extends $fidl.AsyncBinding<TestProtocol> {
- TestProtocolBinding() : super(r"TestProtocol");
-
- @override
- void handleMessage($fidl.Message $message, $fidl.MessageSink $respond) {
- final $fidl.Decoder $decoder = $fidl.Decoder($message)
- ..claimMemory($fidl.kMessageHeaderSize);
- switch ($message.ordinal) {
- case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Ordinal:
- case _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal:
- final String _name =
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
- .name;
- try {
- Timeline.startSync(_name);
- final List<$fidl.MemberType> $types =
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
- .request;
- $decoder.claimMemory(
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
- .decodeRequestInlineSize($decoder));
- final $async.Future<StrictBoundedXUnion> $future =
- impl.strictXUnionHenceResponseMayBeStackAllocated();
- $future.then(($response) {
- final $fidl.Encoder $encoder = $fidl.Encoder();
- $encoder.encodeMessageHeader(
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_GenOrdinal,
- $message.txid);
- $encoder.alloc(
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
- .encodingResponseInlineSize($encoder));
- final List<$fidl.MemberType> $types =
- _kTestProtocol_StrictXUnionHenceResponseMayBeStackAllocated_Type
- .response;
- $types[0].encode($encoder, $response, $fidl.kMessageHeaderSize);
- $respond($encoder.message);
- }, onError: (_e) {
- close();
- print('Exception handling method call $_name: $_e');
- });
- // ignore: avoid_catches_without_on_clauses
- } catch (_e) {
- close();
- print('Exception handling method call $_name: $_e');
- rethrow;
- } finally {
- Timeline.finishSync();
- }
- break;
- case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Ordinal:
- case _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal:
- final String _name =
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
- .name;
- try {
- Timeline.startSync(_name);
- final List<$fidl.MemberType> $types =
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
- .request;
- $decoder.claimMemory(
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
- .decodeRequestInlineSize($decoder));
- final $async.Future<OlderSimpleUnion> $future =
- impl.flexibleXUnionHenceResponseMustBeHeapAllocated();
- $future.then(($response) {
- final $fidl.Encoder $encoder = $fidl.Encoder();
- $encoder.encodeMessageHeader(
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_GenOrdinal,
- $message.txid);
- $encoder.alloc(
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
- .encodingResponseInlineSize($encoder));
- final List<$fidl.MemberType> $types =
- _kTestProtocol_FlexibleXUnionHenceResponseMustBeHeapAllocated_Type
- .response;
- $types[0].encode($encoder, $response, $fidl.kMessageHeaderSize);
- $respond($encoder.message);
- }, onError: (_e) {
- close();
- print('Exception handling method call $_name: $_e');
- });
- // ignore: avoid_catches_without_on_clauses
- } catch (_e) {
- close();
- print('Exception handling method call $_name: $_e');
- rethrow;
- } finally {
- Timeline.finishSync();
- }
- break;
- default:
- throw $fidl.FidlError(
- r'Unexpected message name for TestProtocolBinding');
- }
- }
-}
diff --git a/bin/fidlgen_dart/goldens/xunion.test.json_test.dart.golden b/bin/fidlgen_dart/goldens/xunion.test.json_test.dart.golden
deleted file mode 100644
index fae2630..0000000
--- a/bin/fidlgen_dart/goldens/xunion.test.json_test.dart.golden
+++ /dev/null
@@ -1,35 +0,0 @@
-// WARNING: This file is machine generated by fidlgen.
-
-library fidl_fidl_test_json_test;
-
-import 'dart:async' as $async;
-import 'dart:core' hide Error, Future, Match, Set, Stream, Type;
-import 'dart:typed_data';
-
-import 'package:fidl/fidl.dart' as $fidl;
-import 'package:meta/meta.dart';
-import 'package:zircon/zircon.dart' as $zx;
-
-import './fidl_async.dart';
-
-// ignore_for_file: always_specify_types
-// ignore_for_file: constant_identifier_names
-// ignore_for_file: one_member_abstracts
-// ignore_for_file: public_member_api_docs
-// ignore_for_file: unused_import
-// ignore_for_file: library_prefixes
-// ignore_for_file: unused_shown_name
-
-class TestProtocol$TestBase extends TestProtocol {
- @override
- $async.Future<StrictBoundedXUnion>
- strictXUnionHenceResponseMayBeStackAllocated() {
- return $async.Future.error(UnimplementedError());
- }
-
- @override
- $async.Future<OlderSimpleUnion>
- flexibleXUnionHenceResponseMustBeHeapAllocated() {
- return $async.Future.error(UnimplementedError());
- }
-}