@@ -532,40 +532,34 @@ public override TypePrinterResult VisitParameterDecl(Parameter parameter)
532532 return ret ;
533533 }
534534
535- string GetName ( Declaration decl )
535+ private string GetName ( Declaration decl )
536536 {
537537 var names = new Stack < string > ( ) ;
538538
539- Declaration ctx ;
540- if ( decl is ClassTemplateSpecialization specialization )
539+ Declaration ctx = decl ;
540+ if ( decl is ClassTemplateSpecialization specialization &&
541+ ContextKind == TypePrinterContextKind . Native &&
542+ specialization . OriginalNamespace is Class &&
543+ ! ( specialization . OriginalNamespace is ClassTemplateSpecialization ) )
541544 {
542- ctx = specialization . TemplatedDecl . TemplatedClass . Namespace ;
543- if ( ContextKind == TypePrinterContextKind . Native &&
544- specialization . OriginalNamespace is Class &&
545- ! ( specialization . OriginalNamespace is ClassTemplateSpecialization ) )
546- {
547- names . Push ( string . Format ( "{0}_{1}" , decl . OriginalNamespace . Name , decl . Name ) ) ;
548- ctx = ctx . Namespace ?? ctx ;
549- }
550- else
551- {
552- names . Push ( decl . Name ) ;
553- }
545+ names . Push ( string . Format ( "{0}_{1}" , decl . OriginalNamespace . Name , decl . Name ) ) ;
546+ ctx = ctx . Namespace ?? ctx ;
554547 }
555548 else
556549 {
557550 names . Push ( decl . Name ) ;
558- ctx = decl . Namespace ;
559551 }
560552
561553 if ( decl is Variable && ! ( decl . Namespace is Class ) )
562554 names . Push ( decl . TranslationUnit . FileNameWithoutExtension ) ;
563555
564556 while ( ! ( ctx is TranslationUnit ) )
565557 {
566- AddContextName ( names , ctx ) ;
558+ if ( ctx is ClassTemplateSpecialization parentSpecialization )
559+ ctx = parentSpecialization . TemplatedDecl . TemplatedDecl ;
567560
568561 ctx = ctx . Namespace ;
562+ AddContextName ( names , ctx ) ;
569563 }
570564
571565 if ( PrintModuleOutputNamespace )
0 commit comments