@@ -199,32 +199,32 @@ public virtual TypePrinterResult VisitPrimitiveType(PrimitiveType primitive)
199
199
return PrintFlavorKind == CppTypePrintFlavorKind . Cpp ?
200
200
"std::nullptr_t" : "NULL" ;
201
201
case PrimitiveType . String :
202
+ {
203
+ switch ( PrintFlavorKind )
202
204
{
203
- switch ( PrintFlavorKind )
204
- {
205
- case CppTypePrintFlavorKind . C :
206
- return "const char*" ;
207
- case CppTypePrintFlavorKind . Cpp :
208
- return "std::string" ;
209
- case CppTypePrintFlavorKind . ObjC :
210
- return "NSString" ;
211
- default :
212
- throw new ArgumentOutOfRangeException ( ) ;
213
- }
205
+ case CppTypePrintFlavorKind . C :
206
+ return "const char*" ;
207
+ case CppTypePrintFlavorKind . Cpp :
208
+ return "std::string" ;
209
+ case CppTypePrintFlavorKind . ObjC :
210
+ return "NSString" ;
211
+ default :
212
+ throw new ArgumentOutOfRangeException ( ) ;
214
213
}
214
+ }
215
215
case PrimitiveType . Decimal :
216
+ {
217
+ switch ( PrintFlavorKind )
216
218
{
217
- switch ( PrintFlavorKind )
218
- {
219
- case CppTypePrintFlavorKind . C :
220
- case CppTypePrintFlavorKind . Cpp :
221
- return "_Decimal32" ;
222
- case CppTypePrintFlavorKind . ObjC :
223
- return "NSDecimalNumber" ;
224
- default :
225
- throw new ArgumentOutOfRangeException ( ) ;
226
- }
219
+ case CppTypePrintFlavorKind . C :
220
+ case CppTypePrintFlavorKind . Cpp :
221
+ return "_Decimal32" ;
222
+ case CppTypePrintFlavorKind . ObjC :
223
+ return "NSDecimalNumber" ;
224
+ default :
225
+ throw new ArgumentOutOfRangeException ( ) ;
227
226
}
227
+ }
228
228
}
229
229
230
230
throw new NotSupportedException ( ) ;
@@ -472,58 +472,64 @@ public virtual TypePrinterResult GetDeclName(Declaration declaration,
472
472
switch ( scope )
473
473
{
474
474
case TypePrintScopeKind . Local :
475
+ {
476
+ if ( ContextKind is TypePrinterContextKind . Managed or TypePrinterContextKind . Normal )
475
477
{
476
- if ( ContextKind == TypePrinterContextKind . Managed )
477
- {
478
- return PrintLogicalNames ? declaration . LogicalName : declaration . Name ;
479
- }
480
-
481
- if ( PrefixSpecialFunctions )
482
- {
483
- if ( declaration is Function { IsOperator : true } function )
484
- return $ "operator_{ function . OperatorKind } ";
485
- }
478
+ return PrintLogicalNames ? declaration . LogicalName : declaration . Name ;
479
+ }
486
480
487
- return PrintLogicalNames ? declaration . LogicalOriginalName
488
- : declaration . OriginalName ;
481
+ if ( PrefixSpecialFunctions )
482
+ {
483
+ if ( declaration is Function { IsOperator : true } function )
484
+ return $ "operator_{ function . OperatorKind } ";
489
485
}
486
+
487
+ return PrintLogicalNames ? declaration . LogicalOriginalName
488
+ : declaration . OriginalName ;
489
+ }
490
490
case TypePrintScopeKind . Qualified :
491
+ {
492
+ if ( ContextKind == TypePrinterContextKind . Managed )
491
493
{
492
- if ( ContextKind == TypePrinterContextKind . Managed )
494
+ var outputNamespace = GlobalNamespace ( declaration ) ;
495
+ if ( ! string . IsNullOrEmpty ( outputNamespace ) )
493
496
{
494
- var outputNamespace = GlobalNamespace ( declaration ) ;
495
- if ( ! string . IsNullOrEmpty ( outputNamespace ) )
496
- {
497
- return $ "{ outputNamespace } { NamespaceSeparator } { declaration . QualifiedName } ";
498
- }
499
-
500
- return declaration . QualifiedName ;
497
+ return $ "{ outputNamespace } { NamespaceSeparator } { declaration . QualifiedName } ";
501
498
}
502
499
503
- if ( declaration . Namespace is Class )
504
- {
505
- var declName = GetDeclName ( declaration , TypePrintScopeKind . Local ) ;
506
- bool printTags = PrintTags ;
507
- PrintTags = false ;
508
- TypePrinterResult declContext = declaration . Namespace . Visit ( this ) ;
509
- PrintTags = printTags ;
510
- return $ "{ declContext } { NamespaceSeparator } { declName } ";
511
- }
500
+ return declaration . QualifiedName ;
501
+ }
512
502
513
- return PrintLogicalNames ? declaration . QualifiedLogicalOriginalName
514
- : declaration . QualifiedOriginalName ;
503
+ if ( declaration . Namespace is Class )
504
+ {
505
+ var declName = GetDeclName ( declaration , TypePrintScopeKind . Local ) ;
506
+ bool printTags = PrintTags ;
507
+ PrintTags = false ;
508
+ TypePrinterResult declContext = declaration . Namespace . Visit ( this ) ;
509
+ PrintTags = printTags ;
510
+ return $ "{ declContext } { NamespaceSeparator } { declName } ";
515
511
}
516
- case TypePrintScopeKind . GlobalQualified :
512
+
513
+ if ( ContextKind == TypePrinterContextKind . Normal )
517
514
{
518
- var name = ( ContextKind == TypePrinterContextKind . Managed ) ?
519
- declaration . Name : declaration . OriginalName ;
515
+ return PrintLogicalNames ? declaration . QualifiedLogicalName
516
+ : declaration . QualifiedName ;
517
+ }
518
+
519
+ return PrintLogicalNames ? declaration . QualifiedLogicalOriginalName
520
+ : declaration . QualifiedOriginalName ;
521
+ }
522
+ case TypePrintScopeKind . GlobalQualified :
523
+ {
524
+ var name = ( ContextKind == TypePrinterContextKind . Managed ) ?
525
+ declaration . Name : declaration . OriginalName ;
520
526
521
- if ( declaration . Namespace is Class )
522
- return $ "{ declaration . Namespace . Visit ( this ) } { NamespaceSeparator } { name } ";
527
+ if ( declaration . Namespace is Class )
528
+ return $ "{ declaration . Namespace . Visit ( this ) } { NamespaceSeparator } { name } ";
523
529
524
- var qualifier = HasGlobalNamespacePrefix ? NamespaceSeparator : string . Empty ;
525
- return qualifier + GetDeclName ( declaration , TypePrintScopeKind . Qualified ) ;
526
- }
530
+ var qualifier = HasGlobalNamespacePrefix ? NamespaceSeparator : string . Empty ;
531
+ return qualifier + GetDeclName ( declaration , TypePrintScopeKind . Qualified ) ;
532
+ }
527
533
}
528
534
529
535
throw new NotSupportedException ( ) ;
0 commit comments