@@ -775,7 +775,7 @@ class NodePrinter {
775775
776776 void printFunctionType (NodePointer LabelList, NodePointer node,
777777 unsigned depth) {
778- if (node->getNumChildren () < 2 || node-> getNumChildren () > 6 ) {
778+ if (node->getNumChildren () < 2 ) {
779779 setInvalid ();
780780 return ;
781781 }
@@ -814,9 +814,14 @@ class NodePrinter {
814814 assert (false && " Unhandled function type in printFunctionType!" );
815815 }
816816
817+ unsigned argIndex = node->getNumChildren () - 2 ;
817818 unsigned startIndex = 0 ;
818819 bool isSendable = false , isAsync = false , isThrows = false ;
819820 auto diffKind = MangledDifferentiabilityKind::NonDifferentiable;
821+ if (node->getChild (startIndex)->getKind () == Node::Kind::ClangType) {
822+ // handled earlier
823+ ++startIndex;
824+ }
820825 if (node->getChild (startIndex)->getKind () ==
821826 Node::Kind::GlobalActorFunctionType) {
822827 print (node->getChild (startIndex), depth + 1 );
@@ -828,10 +833,6 @@ class NodePrinter {
828833 (MangledDifferentiabilityKind)node->getChild (startIndex)->getIndex ();
829834 ++startIndex;
830835 }
831- if (node->getChild (startIndex)->getKind () == Node::Kind::ClangType) {
832- // handled earlier
833- ++startIndex;
834- }
835836 if (node->getChild (startIndex)->getKind () == Node::Kind::ThrowsAnnotation) {
836837 ++startIndex;
837838 isThrows = true ;
@@ -866,7 +867,7 @@ class NodePrinter {
866867 if (isSendable)
867868 Printer << " @Sendable " ;
868869
869- printFunctionParameters (LabelList, node->getChild (startIndex ), depth,
870+ printFunctionParameters (LabelList, node->getChild (argIndex ), depth,
870871 Options.ShowFunctionArgumentTypes );
871872
872873 if (!Options.ShowFunctionArgumentTypes )
@@ -878,7 +879,7 @@ class NodePrinter {
878879 if (isThrows)
879880 Printer << " throws" ;
880881
881- print (node->getChild (startIndex + 1 ), depth + 1 );
882+ print (node->getChild (argIndex + 1 ), depth + 1 );
882883 }
883884
884885 void printImplFunctionType (NodePointer fn, unsigned depth) {
0 commit comments