@@ -199,32 +199,32 @@ public virtual TypePrinterResult VisitPrimitiveType(PrimitiveType primitive)
199199 return PrintFlavorKind == CppTypePrintFlavorKind . Cpp ?
200200 "std::nullptr_t" : "NULL" ;
201201 case PrimitiveType . String :
202+ {
203+ switch ( PrintFlavorKind )
202204 {
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 ( ) ;
214213 }
214+ }
215215 case PrimitiveType . Decimal :
216+ {
217+ switch ( PrintFlavorKind )
216218 {
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 ( ) ;
227226 }
227+ }
228228 }
229229
230230 throw new NotSupportedException ( ) ;
@@ -472,58 +472,64 @@ public virtual TypePrinterResult GetDeclName(Declaration declaration,
472472 switch ( scope )
473473 {
474474 case TypePrintScopeKind . Local :
475+ {
476+ if ( ContextKind is TypePrinterContextKind . Managed or TypePrinterContextKind . Normal )
475477 {
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+ }
486480
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 } ";
489485 }
486+
487+ return PrintLogicalNames ? declaration . LogicalOriginalName
488+ : declaration . OriginalName ;
489+ }
490490 case TypePrintScopeKind . Qualified :
491+ {
492+ if ( ContextKind == TypePrinterContextKind . Managed )
491493 {
492- if ( ContextKind == TypePrinterContextKind . Managed )
494+ var outputNamespace = GlobalNamespace ( declaration ) ;
495+ if ( ! string . IsNullOrEmpty ( outputNamespace ) )
493496 {
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 } ";
501498 }
502499
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+ }
512502
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 } ";
515511 }
516- case TypePrintScopeKind . GlobalQualified :
512+
513+ if ( ContextKind == TypePrinterContextKind . Normal )
517514 {
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 ;
520526
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 } ";
523529
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+ }
527533 }
528534
529535 throw new NotSupportedException ( ) ;
0 commit comments