@@ -772,7 +772,7 @@ class NodePrinter {
772
772
}
773
773
774
774
void printFunctionType (NodePointer LabelList, NodePointer node) {
775
- if (node->getNumChildren () < 2 || node-> getNumChildren () > 6 ) {
775
+ if (node->getNumChildren () < 2 ) {
776
776
setInvalid ();
777
777
return ;
778
778
}
@@ -811,9 +811,14 @@ class NodePrinter {
811
811
assert (false && " Unhandled function type in printFunctionType!" );
812
812
}
813
813
814
+ unsigned argIndex = node->getNumChildren () - 2 ;
814
815
unsigned startIndex = 0 ;
815
816
bool isSendable = false , isAsync = false , isThrows = false ;
816
817
auto diffKind = MangledDifferentiabilityKind::NonDifferentiable;
818
+ if (node->getChild (startIndex)->getKind () == Node::Kind::ClangType) {
819
+ // handled earlier
820
+ ++startIndex;
821
+ }
817
822
if (node->getChild (startIndex)->getKind () ==
818
823
Node::Kind::GlobalActorFunctionType) {
819
824
print (node->getChild (startIndex));
@@ -825,10 +830,6 @@ class NodePrinter {
825
830
(MangledDifferentiabilityKind)node->getChild (startIndex)->getIndex ();
826
831
++startIndex;
827
832
}
828
- if (node->getChild (startIndex)->getKind () == Node::Kind::ClangType) {
829
- // handled earlier
830
- ++startIndex;
831
- }
832
833
if (node->getChild (startIndex)->getKind () == Node::Kind::ThrowsAnnotation) {
833
834
++startIndex;
834
835
isThrows = true ;
@@ -863,7 +864,7 @@ class NodePrinter {
863
864
if (isSendable)
864
865
Printer << " @Sendable " ;
865
866
866
- printFunctionParameters (LabelList, node->getChild (startIndex ),
867
+ printFunctionParameters (LabelList, node->getChild (argIndex ),
867
868
Options.ShowFunctionArgumentTypes );
868
869
869
870
if (!Options.ShowFunctionArgumentTypes )
@@ -875,7 +876,7 @@ class NodePrinter {
875
876
if (isThrows)
876
877
Printer << " throws" ;
877
878
878
- print (node->getChild (startIndex + 1 ));
879
+ print (node->getChild (argIndex + 1 ));
879
880
}
880
881
881
882
void printImplFunctionType (NodePointer fn) {
0 commit comments