@@ -982,6 +982,49 @@ class NodePrinter {
982
982
}
983
983
}
984
984
985
+ void printGenericSignature (NodePointer Node, unsigned depth) {
986
+ Printer << ' <' ;
987
+
988
+ unsigned gpDepth = 0 ;
989
+ unsigned numChildren = Node->getNumChildren ();
990
+ for (;
991
+ gpDepth < numChildren
992
+ && Node->getChild (gpDepth)->getKind ()
993
+ == Node::Kind::DependentGenericParamCount;
994
+ ++gpDepth) {
995
+ if (gpDepth != 0 )
996
+ Printer << " ><" ;
997
+
998
+ unsigned count = Node->getChild (gpDepth)->getIndex ();
999
+ for (unsigned index = 0 ; index < count; ++index) {
1000
+ if (index != 0 )
1001
+ Printer << " , " ;
1002
+ // Limit the number of printed generic parameters. In practice this
1003
+ // it will never be exceeded. The limit is only important for malformed
1004
+ // symbols where count can be really huge.
1005
+ if (index >= 128 ) {
1006
+ Printer << " ..." ;
1007
+ break ;
1008
+ }
1009
+ // FIXME: Depth won't match when a generic signature applies to a
1010
+ // method in generic type context.
1011
+ Printer << Options.GenericParameterName (gpDepth, index);
1012
+ }
1013
+ }
1014
+
1015
+ if (gpDepth != numChildren) {
1016
+ if (Options.DisplayWhereClauses ) {
1017
+ Printer << " where " ;
1018
+ for (unsigned i = gpDepth; i < numChildren; ++i) {
1019
+ if (i > gpDepth)
1020
+ Printer << " , " ;
1021
+ print (Node->getChild (i), depth + 1 );
1022
+ }
1023
+ }
1024
+ }
1025
+ Printer << ' >' ;
1026
+ }
1027
+
985
1028
void printFunctionSigSpecializationParams (NodePointer Node, unsigned depth);
986
1029
987
1030
void printSpecializationPrefix (NodePointer node, StringRef Description,
@@ -2634,46 +2677,7 @@ NodePointer NodePrinter::print(NodePointer Node, unsigned depth,
2634
2677
2635
2678
case Node::Kind::DependentPseudogenericSignature:
2636
2679
case Node::Kind::DependentGenericSignature: {
2637
- Printer << ' <' ;
2638
-
2639
- unsigned depth = 0 ;
2640
- unsigned numChildren = Node->getNumChildren ();
2641
- for (;
2642
- depth < numChildren
2643
- && Node->getChild (depth)->getKind ()
2644
- == Node::Kind::DependentGenericParamCount;
2645
- ++depth) {
2646
- if (depth != 0 )
2647
- Printer << " ><" ;
2648
-
2649
- unsigned count = Node->getChild (depth)->getIndex ();
2650
- for (unsigned index = 0 ; index < count; ++index) {
2651
- if (index != 0 )
2652
- Printer << " , " ;
2653
- // Limit the number of printed generic parameters. In practice this
2654
- // it will never be exceeded. The limit is only important for malformed
2655
- // symbols where count can be really huge.
2656
- if (index >= 128 ) {
2657
- Printer << " ..." ;
2658
- break ;
2659
- }
2660
- // FIXME: Depth won't match when a generic signature applies to a
2661
- // method in generic type context.
2662
- Printer << Options.GenericParameterName (depth, index);
2663
- }
2664
- }
2665
-
2666
- if (depth != numChildren) {
2667
- if (Options.DisplayWhereClauses ) {
2668
- Printer << " where " ;
2669
- for (unsigned i = depth; i < numChildren; ++i) {
2670
- if (i > depth)
2671
- Printer << " , " ;
2672
- print (Node->getChild (i), depth + 1 );
2673
- }
2674
- }
2675
- }
2676
- Printer << ' >' ;
2680
+ printGenericSignature (Node, depth);
2677
2681
return nullptr ;
2678
2682
}
2679
2683
case Node::Kind::DependentGenericParamCount:
0 commit comments