@@ -730,6 +730,22 @@ NodePointer Demangler::demangleSymbolicReference(unsigned char rawKind) {
730
730
return resolved;
731
731
}
732
732
733
+ NodePointer Demangler::demangleTypeAnnotation () {
734
+ switch (char c2 = nextChar ()) {
735
+ case ' a' :
736
+ return createNode (Node::Kind::AsyncAnnotation);
737
+ case ' b' :
738
+ return createNode (Node::Kind::ConcurrentFunctionType);
739
+ case ' j' :
740
+ return demangleDifferentiableFunctionType ();
741
+ case ' k' :
742
+ return createType (
743
+ createWithChild (Node::Kind::NoDerivative, popTypeAndGetChild ()));
744
+ default :
745
+ return nullptr ;
746
+ }
747
+ }
748
+
733
749
NodePointer Demangler::demangleOperator () {
734
750
recur:
735
751
switch (unsigned char c = nextChar ()) {
@@ -767,7 +783,6 @@ NodePointer Demangler::demangleOperator() {
767
783
}
768
784
769
785
case ' I' : return demangleImplFunctionType ();
770
- case ' J' : return createNode (Node::Kind::ConcurrentFunctionType);
771
786
case ' K' : return createNode (Node::Kind::ThrowsAnnotation);
772
787
case ' L' : return demangleLocalIdentifier ();
773
788
case ' M' : return demangleMetatype ();
@@ -782,7 +797,7 @@ NodePointer Demangler::demangleOperator() {
782
797
case ' V' : return demangleAnyGenericType (Node::Kind::Structure);
783
798
case ' W' : return demangleWitness ();
784
799
case ' X' : return demangleSpecialType ();
785
- case ' Y' : return createNode (Node::Kind::AsyncAnnotation );
800
+ case ' Y' : return demangleTypeAnnotation ( );
786
801
case ' Z' : return createWithChild (Node::Kind::Static, popNode (isEntity));
787
802
case ' a' : return demangleAnyGenericType (Node::Kind::TypeAlias);
788
803
case ' c' : return popFunctionType (Node::Kind::FunctionType);
@@ -792,10 +807,6 @@ NodePointer Demangler::demangleOperator() {
792
807
case ' h' : return createType (createWithChild (Node::Kind::Shared,
793
808
popTypeAndGetChild ()));
794
809
case ' i' : return demangleSubscript ();
795
- case ' j' : return demangleDifferentiableFunctionType ();
796
- case ' k' :
797
- return createType (
798
- createWithChild (Node::Kind::NoDerivative, popTypeAndGetChild ()));
799
810
case ' l' : return demangleGenericSignature (/* hasParamCounts*/ false );
800
811
case ' m' : return createType (createWithChild (Node::Kind::Metatype,
801
812
popNode (Node::Kind::Type)));
@@ -1257,10 +1268,10 @@ NodePointer Demangler::popFunctionType(Node::Kind kind, bool hasClangType) {
1257
1268
ClangType = demangleClangType ();
1258
1269
}
1259
1270
addChild (FuncType, ClangType);
1271
+ addChild (FuncType, popNode (Node::Kind::DifferentiableFunctionType));
1260
1272
addChild (FuncType, popNode (Node::Kind::ThrowsAnnotation));
1261
1273
addChild (FuncType, popNode (Node::Kind::ConcurrentFunctionType));
1262
1274
addChild (FuncType, popNode (Node::Kind::AsyncAnnotation));
1263
- addChild (FuncType, popNode (Node::Kind::DifferentiableFunctionType));
1264
1275
1265
1276
FuncType = addChild (FuncType, popFunctionParams (Node::Kind::ArgumentTuple));
1266
1277
FuncType = addChild (FuncType, popFunctionParams (Node::Kind::ReturnType));
@@ -1293,6 +1304,9 @@ NodePointer Demangler::popFunctionParamLabels(NodePointer Type) {
1293
1304
return nullptr ;
1294
1305
1295
1306
unsigned FirstChildIdx = 0 ;
1307
+ if (FuncType->getChild (FirstChildIdx)->getKind ()
1308
+ == Node::Kind::DifferentiableFunctionType)
1309
+ ++FirstChildIdx;
1296
1310
if (FuncType->getChild (FirstChildIdx)->getKind ()
1297
1311
== Node::Kind::ThrowsAnnotation)
1298
1312
++FirstChildIdx;
@@ -1302,9 +1316,6 @@ NodePointer Demangler::popFunctionParamLabels(NodePointer Type) {
1302
1316
if (FuncType->getChild (FirstChildIdx)->getKind ()
1303
1317
== Node::Kind::AsyncAnnotation)
1304
1318
++FirstChildIdx;
1305
- if (FuncType->getChild (FirstChildIdx)->getKind ()
1306
- == Node::Kind::DifferentiableFunctionType)
1307
- ++FirstChildIdx;
1308
1319
auto ParameterType = FuncType->getChild (FirstChildIdx);
1309
1320
1310
1321
assert (ParameterType->getKind () == Node::Kind::ArgumentTuple);
0 commit comments