@@ -98,7 +98,7 @@ pub fn default_activator(encoding: Encoding) -> &'static str {
98
98
fn decode_member ( member : & impl Member , namespace : & str , encoding : Encoding ) -> CodeBlock {
99
99
let mut code = CodeBlock :: default ( ) ;
100
100
let data_type = member. data_type ( ) ;
101
- let type_string = data_type. cs_type_string ( namespace, TypeContext :: Decode , true ) ;
101
+ let type_string = data_type. cs_type_string ( namespace, TypeContext :: IncomingParam , true ) ;
102
102
103
103
if data_type. is_optional {
104
104
match data_type. concrete_type ( ) {
@@ -199,11 +199,11 @@ pub fn decode_dictionary(dictionary_ref: &TypeRef<Dictionary>, namespace: &str,
199
199
write ! (
200
200
decode_value,
201
201
" as {}" ,
202
- value_type. cs_type_string( namespace, TypeContext :: Nested , true ) ,
202
+ value_type. cs_type_string( namespace, TypeContext :: Field , true ) ,
203
203
) ;
204
204
}
205
205
206
- let dictionary_type = dictionary_ref. cs_type_string ( namespace, TypeContext :: Decode , true ) ;
206
+ let dictionary_type = dictionary_ref. cs_type_string ( namespace, TypeContext :: IncomingParam , true ) ;
207
207
let decode_key = decode_key. indent ( ) ;
208
208
let decode_value = decode_value. indent ( ) ;
209
209
@@ -257,20 +257,20 @@ pub fn decode_sequence(sequence_ref: &TypeRef<Sequence>, namespace: &str, encodi
257
257
write ! (
258
258
code,
259
259
"({}[])" ,
260
- element_type. cs_type_string( namespace, TypeContext :: Nested , false ) ,
260
+ element_type. cs_type_string( namespace, TypeContext :: Field , false ) ,
261
261
) ;
262
262
} ;
263
263
264
264
if has_cs_type_attribute {
265
- let sequence_type = sequence_ref. cs_type_string ( namespace, TypeContext :: Decode , true ) ;
265
+ let sequence_type = sequence_ref. cs_type_string ( namespace, TypeContext :: IncomingParam , true ) ;
266
266
267
267
let arg: Option < String > = match element_type. concrete_type ( ) {
268
268
Types :: Primitive ( primitive) if primitive. fixed_wire_size ( ) . is_some ( ) && !element_type. is_optional => {
269
269
// We always read an array even when mapped to a collection, as it's expected to be
270
270
// faster than decoding the collection elements one by one.
271
271
Some ( format ! (
272
272
"decoder.DecodeSequence<{}>({})" ,
273
- element_type. cs_type_string( namespace, TypeContext :: Decode , true ) ,
273
+ element_type. cs_type_string( namespace, TypeContext :: IncomingParam , true ) ,
274
274
if matches!( primitive, Primitive :: Bool ) {
275
275
"checkElement: SliceDecoder.CheckBoolValue"
276
276
} else {
@@ -288,14 +288,14 @@ pub fn decode_sequence(sequence_ref: &TypeRef<Sequence>, namespace: &str, encodi
288
288
if enum_def. is_unchecked {
289
289
Some ( format ! (
290
290
"decoder.DecodeSequence<{}>()" ,
291
- element_type. cs_type_string( namespace, TypeContext :: Decode , true ) ,
291
+ element_type. cs_type_string( namespace, TypeContext :: IncomingParam , true ) ,
292
292
) )
293
293
} else {
294
294
Some ( format ! (
295
295
"\
296
296
decoder.DecodeSequence(
297
297
({enum_type_name} e) => _ = {underlying_extensions_class}.As{name}(({underlying_type})e))" ,
298
- enum_type_name = element_type. cs_type_string( namespace, TypeContext :: Decode , false ) ,
298
+ enum_type_name = element_type. cs_type_string( namespace, TypeContext :: IncomingParam , false ) ,
299
299
underlying_extensions_class = enum_def. escape_scoped_identifier_with_suffix(
300
300
& format!(
301
301
"{}Extensions" ,
@@ -355,7 +355,7 @@ decoder.DecodeSequenceOfOptionals(
355
355
write ! (
356
356
code,
357
357
"decoder.DecodeSequence<{}>({})" ,
358
- element_type. cs_type_string( namespace, TypeContext :: Decode , true ) ,
358
+ element_type. cs_type_string( namespace, TypeContext :: IncomingParam , true ) ,
359
359
if matches!( primitive, Primitive :: Bool ) {
360
360
"checkElement: SliceDecoder.CheckBoolValue"
361
361
} else {
@@ -368,15 +368,15 @@ decoder.DecodeSequenceOfOptionals(
368
368
write ! (
369
369
code,
370
370
"decoder.DecodeSequence<{}>()" ,
371
- element_type. cs_type_string( namespace, TypeContext :: Decode , true ) ,
371
+ element_type. cs_type_string( namespace, TypeContext :: IncomingParam , true ) ,
372
372
)
373
373
} else {
374
374
write ! (
375
375
code,
376
376
"\
377
377
decoder.DecodeSequence(
378
378
({enum_type} e) => _ = {underlying_extensions_class}.As{name}(({underlying_type})e))" ,
379
- enum_type = element_type. cs_type_string( namespace, TypeContext :: Decode , false ) ,
379
+ enum_type = element_type. cs_type_string( namespace, TypeContext :: IncomingParam , false ) ,
380
380
underlying_extensions_class = enum_def. escape_scoped_identifier_with_suffix(
381
381
& format!(
382
382
"{}Extensions" ,
@@ -424,7 +424,7 @@ fn decode_result_field(type_ref: &TypeRef, namespace: &str, encoding: Encoding)
424
424
write ! (
425
425
decode_func_body,
426
426
" as {}" ,
427
- type_ref. cs_type_string( namespace, TypeContext :: Nested , false ) ,
427
+ type_ref. cs_type_string( namespace, TypeContext :: Field , false ) ,
428
428
) ;
429
429
}
430
430
@@ -445,7 +445,7 @@ fn decode_result_field(type_ref: &TypeRef, namespace: &str, encoding: Encoding)
445
445
write ! (
446
446
decode_func,
447
447
" as {}" ,
448
- type_ref. cs_type_string( namespace, TypeContext :: Nested , false ) ,
448
+ type_ref. cs_type_string( namespace, TypeContext :: Field , false ) ,
449
449
) ;
450
450
}
451
451
@@ -461,7 +461,7 @@ pub fn decode_func(type_ref: &TypeRef, namespace: &str, encoding: Encoding) -> C
461
461
462
462
fn decode_func_body ( type_ref : & TypeRef , namespace : & str , encoding : Encoding ) -> CodeBlock {
463
463
let mut code = CodeBlock :: default ( ) ;
464
- let type_name = type_ref. cs_type_string ( namespace, TypeContext :: Decode , true ) ;
464
+ let type_name = type_ref. cs_type_string ( namespace, TypeContext :: IncomingParam , true ) ;
465
465
466
466
// When we decode the type, we decode it as a non-optional.
467
467
// If the type is supposed to be optional, we cast it after decoding.
@@ -548,7 +548,7 @@ pub fn decode_operation(operation: &Operation, dispatch: bool) -> CodeBlock {
548
548
// For optional value types we have to use the full type as the compiler cannot
549
549
// disambiguate between null and the actual value type.
550
550
param_type = match member. data_type( ) . is_optional && member. data_type( ) . is_value_type( ) {
551
- true => member. data_type( ) . cs_type_string( namespace, TypeContext :: Decode , false ) ,
551
+ true => member. data_type( ) . cs_type_string( namespace, TypeContext :: IncomingParam , false ) ,
552
552
false => String :: from( "var" ) ,
553
553
} ,
554
554
param_name = & member. parameter_name_with_prefix( "sliceP_" ) ,
@@ -563,7 +563,7 @@ pub fn decode_operation(operation: &Operation, dispatch: bool) -> CodeBlock {
563
563
// For optional value types we have to use the full type as the compiler cannot
564
564
// disambiguate between null and the actual value type.
565
565
param_type = match member. data_type( ) . is_value_type( ) {
566
- true => member. data_type( ) . cs_type_string( namespace, TypeContext :: Decode , false ) ,
566
+ true => member. data_type( ) . cs_type_string( namespace, TypeContext :: IncomingParam , false ) ,
567
567
false => String :: from( "var" ) ,
568
568
} ,
569
569
param_name = & member. parameter_name_with_prefix( "sliceP_" ) ,
@@ -589,7 +589,7 @@ pub fn decode_operation_stream(
589
589
) -> CodeBlock {
590
590
let cs_encoding = encoding. to_cs_encoding ( ) ;
591
591
let param_type = stream_member. data_type ( ) ;
592
- let param_type_str = param_type. cs_type_string ( namespace, TypeContext :: Decode , false ) ;
592
+ let param_type_str = param_type. cs_type_string ( namespace, TypeContext :: IncomingParam , false ) ;
593
593
let fixed_wire_size = param_type. fixed_wire_size ( ) ;
594
594
595
595
match param_type. concrete_type ( ) {
0 commit comments