|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
| 3 | +using System.Globalization; |
3 | 4 | using System.Linq; |
4 | 5 | using CppSharp.AST; |
5 | 6 | using CppSharp.AST.Extensions; |
@@ -559,8 +560,31 @@ public override TypePrinterResult VisitClassDecl(Class @class) |
559 | 560 | public override TypePrinterResult VisitClassTemplateSpecializationDecl( |
560 | 561 | ClassTemplateSpecialization specialization) |
561 | 562 | { |
562 | | - var args = specialization.Arguments.Where(a => a.Type.Type != null && |
563 | | - !(a.Type.Type is DependentNameType)).Select(a => a.Type.Visit(this)); |
| 563 | + var args = new List<string>(); |
| 564 | + for (int i = 0; i < specialization.Arguments.Count; i++) |
| 565 | + { |
| 566 | + TemplateArgument arg = specialization.Arguments[i]; |
| 567 | + switch (arg.Kind) |
| 568 | + { |
| 569 | + case TemplateArgument.ArgumentKind.Type: |
| 570 | + args.Add(arg.Type.Visit(this)); |
| 571 | + break; |
| 572 | + case TemplateArgument.ArgumentKind.Declaration: |
| 573 | + args.Add(arg.Declaration.Visit(this)); |
| 574 | + break; |
| 575 | + case TemplateArgument.ArgumentKind.Integral: |
| 576 | + Class template = specialization.TemplatedDecl.TemplatedClass; |
| 577 | + var nonTypeTemplateParameter = template.TemplateParameters[i] |
| 578 | + as NonTypeTemplateParameter; |
| 579 | + if (!(nonTypeTemplateParameter?.DefaultArgument is |
| 580 | + BuiltinTypeExpressionObsolete builtinExpression) || |
| 581 | + builtinExpression.Value != arg.Integral) |
| 582 | + { |
| 583 | + args.Add(arg.Integral.ToString(CultureInfo.InvariantCulture)); |
| 584 | + } |
| 585 | + break; |
| 586 | + } |
| 587 | + } |
564 | 588 | return $"{specialization.TemplatedDecl.Visit(this)}<{string.Join(", ", args)}>"; |
565 | 589 | } |
566 | 590 |
|
|
0 commit comments