(TypeInfo typeInfo, ReadContext context)
| 1087 | } |
| 1088 | |
| 1089 | internal object? ReadAnyValue(TypeInfo typeInfo, ReadContext context) |
| 1090 | { |
| 1091 | TypeId wireTypeId = typeInfo.WireTypeId |
| 1092 | ?? throw new InvalidDataException($"missing read wire type for {typeInfo.Type}"); |
| 1093 | // ReadAnyValue is the shared self-describing payload entry for object/Any, |
| 1094 | // UnknownCase, and compatible field skipping. The Any envelope is not a |
| 1095 | // nesting boundary; only payloads that can recursively contain values |
| 1096 | // advance depth. If a nested read fails, the root context reset owns |
| 1097 | // cleanup of partially advanced depth and type-info state. |
| 1098 | switch (wireTypeId) |
| 1099 | { |
| 1100 | case TypeId.Int32: |
| 1101 | return context.Reader.ReadInt32(); |
| 1102 | case TypeId.Int64: |
| 1103 | return context.Reader.ReadInt64(); |
| 1104 | case TypeId.TaggedInt64: |
| 1105 | return context.Reader.ReadTaggedInt64(); |
| 1106 | case TypeId.UInt32: |
| 1107 | return context.Reader.ReadUInt32(); |
| 1108 | case TypeId.UInt64: |
| 1109 | return context.Reader.ReadUInt64(); |
| 1110 | case TypeId.TaggedUInt64: |
| 1111 | return context.Reader.ReadTaggedUInt64(); |
| 1112 | case TypeId.List: |
| 1113 | case TypeId.Set: |
| 1114 | case TypeId.Union: |
| 1115 | return ReadNestedAnyData(typeInfo, context); |
| 1116 | case TypeId.Map: |
| 1117 | return ReadNestedAnyMap(context); |
| 1118 | case TypeId.Struct: |
| 1119 | case TypeId.Ext: |
| 1120 | case TypeId.TypedUnion: |
| 1121 | case TypeId.NamedStruct: |
| 1122 | case TypeId.NamedExt: |
| 1123 | case TypeId.NamedUnion: |
| 1124 | case TypeId.CompatibleStruct: |
| 1125 | case TypeId.NamedCompatibleStruct: |
| 1126 | return ReadNestedRegisteredValue(typeInfo, context, typeInfo.GetTypeMeta()); |
| 1127 | case TypeId.Enum: |
| 1128 | case TypeId.NamedEnum: |
| 1129 | return ReadRegisteredValue(typeInfo, context, typeInfo.GetTypeMeta()); |
| 1130 | case TypeId.None: |
| 1131 | return null; |
| 1132 | default: |
| 1133 | return ReadDataObject(typeInfo, context); |
| 1134 | } |
| 1135 | } |
| 1136 | |
| 1137 | private object? ReadNestedAnyData(TypeInfo typeInfo, ReadContext context) |
| 1138 | { |
no test coverage detected