@@ -32,14 +32,14 @@ public void MergeFrom(CodedInputStream input)
32
32
: ParseUnknownField ( input , new WireTag ( index , type ) ) ;
33
33
fields . AddRange ( parsedFields ) ;
34
34
}
35
- Result = new TypedMessage ( fields , messageDef ) ;
35
+ Result = new TypedMessage ( fields , messageDef , messageDef ) ;
36
36
}
37
37
38
38
private IEnumerable < TypedField > ParseUnknownField ( CodedInputStream stream , WireTag wireTag )
39
39
{
40
40
var ( index , type ) = wireTag ;
41
41
var value = stream . ReadType ( type ) ;
42
- yield return new TypedField ( "Unknown" , index , new TypedUnknown ( value ) ) ;
42
+ yield return new TypedField ( "Unknown" , index , null , new TypedUnknown ( value ) ) ;
43
43
}
44
44
45
45
private IEnumerable < TypedField > ParseField ( CodedInputStream stream , ProtoContext protoContext , FieldType type , FieldContext field )
@@ -48,7 +48,7 @@ private IEnumerable<TypedField> ParseField(CodedInputStream stream, ProtoContext
48
48
var values = ReadExpectedType ( stream , protoContext , type , field . type_ ( ) ) ;
49
49
foreach ( var value in values )
50
50
{
51
- yield return new TypedField ( fieldName , index , value ) ;
51
+ yield return new TypedField ( fieldName , index , field , value ) ;
52
52
}
53
53
}
54
54
@@ -78,38 +78,38 @@ private static IEnumerable<ProtoType> ReadExpectedType(CodedInputStream stream,
78
78
private static ProtoType ? ReadExpectedType ( CodedInputStream stream , ProtoContext protoContext , Type_Context expectedType )
79
79
{
80
80
if ( expectedType . INT32 ( ) is not null )
81
- return new TypedInt32 ( stream . ReadInt32 ( ) ) ;
81
+ return new TypedInt32 ( stream . ReadInt32 ( ) , expectedType ) ;
82
82
else if ( expectedType . INT64 ( ) is not null )
83
- return new TypedInt64 ( stream . ReadInt64 ( ) ) ;
83
+ return new TypedInt64 ( stream . ReadInt64 ( ) , expectedType ) ;
84
84
else if ( expectedType . SINT32 ( ) is not null )
85
- return new TypedSint32 ( stream . ReadSInt32 ( ) ) ;
85
+ return new TypedSint32 ( stream . ReadSInt32 ( ) , expectedType ) ;
86
86
else if ( expectedType . SINT64 ( ) is not null )
87
- return new TypedSint64 ( stream . ReadSInt64 ( ) ) ;
87
+ return new TypedSint64 ( stream . ReadSInt64 ( ) , expectedType ) ;
88
88
else if ( expectedType . UINT32 ( ) is not null )
89
- return new TypedUint32 ( stream . ReadUInt32 ( ) ) ;
89
+ return new TypedUint32 ( stream . ReadUInt32 ( ) , expectedType ) ;
90
90
else if ( expectedType . UINT64 ( ) is not null )
91
- return new TypedUint64 ( stream . ReadUInt64 ( ) ) ;
91
+ return new TypedUint64 ( stream . ReadUInt64 ( ) , expectedType ) ;
92
92
else if ( expectedType . BOOL ( ) is not null )
93
- return new TypedBool ( stream . ReadBool ( ) ) ;
93
+ return new TypedBool ( stream . ReadBool ( ) , expectedType ) ;
94
94
else if ( expectedType . FIXED32 ( ) is not null )
95
- return new TypedFixed32 ( stream . ReadFixed32 ( ) ) ;
95
+ return new TypedFixed32 ( stream . ReadFixed32 ( ) , expectedType ) ;
96
96
else if ( expectedType . FIXED64 ( ) is not null )
97
- return new TypedFixed64 ( stream . ReadFixed64 ( ) ) ;
97
+ return new TypedFixed64 ( stream . ReadFixed64 ( ) , expectedType ) ;
98
98
else if ( expectedType . SFIXED32 ( ) is not null )
99
- return new TypedSfixed32 ( stream . ReadSFixed32 ( ) ) ;
99
+ return new TypedSfixed32 ( stream . ReadSFixed32 ( ) , expectedType ) ;
100
100
else if ( expectedType . SFIXED64 ( ) is not null )
101
- return new TypedSfixed64 ( stream . ReadSFixed64 ( ) ) ;
101
+ return new TypedSfixed64 ( stream . ReadSFixed64 ( ) , expectedType ) ;
102
102
else if ( expectedType . DOUBLE ( ) is not null )
103
- return new TypedDouble ( stream . ReadDouble ( ) ) ;
103
+ return new TypedDouble ( stream . ReadDouble ( ) , expectedType ) ;
104
104
else if ( expectedType . FLOAT ( ) is not null )
105
- return new TypedFloat ( stream . ReadFloat ( ) ) ;
105
+ return new TypedFloat ( stream . ReadFloat ( ) , expectedType ) ;
106
106
else if ( expectedType . STRING ( ) is not null )
107
- return new TypedString ( stream . ReadString ( ) ) ;
107
+ return new TypedString ( stream . ReadString ( ) , expectedType ) ;
108
108
else if ( expectedType . enumType ( ) is not null || expectedType . messageType ( ) is not null )
109
109
{
110
110
return BindMessageOrEnumDef ( protoContext , expectedType ) switch
111
111
{
112
- EnumDefContext enumDef => new TypedEnum ( stream . ReadEnum ( ) , enumDef ) ,
112
+ EnumDefContext enumDef => new TypedEnum ( stream . ReadEnum ( ) , expectedType , enumDef ) ,
113
113
MessageDefContext innerMessageDef => ParseMessage ( stream , protoContext , innerMessageDef ) ,
114
114
_ => throw new NotImplementedException ( ) ,
115
115
} ;
0 commit comments