@@ -278,8 +278,10 @@ class NodePrinter {
278
278
case Node::Kind::ProtocolList:
279
279
return Node->getChild (0 )->getNumChildren () <= 1 ;
280
280
281
- case Node::Kind::ProtocolListWithClass:
282
281
case Node::Kind::ProtocolListWithAnyObject:
282
+ return Node->getChild (0 )->getChild (0 )->getNumChildren () == 0 ;
283
+
284
+ case Node::Kind::ProtocolListWithClass:
283
285
case Node::Kind::Allocator:
284
286
case Node::Kind::ArgumentTuple:
285
287
case Node::Kind::AssociatedTypeMetadataAccessor:
@@ -628,7 +630,8 @@ class NodePrinter {
628
630
static bool isExistentialType (NodePointer node) {
629
631
return (node->getKind () == Node::Kind::ExistentialMetatype ||
630
632
node->getKind () == Node::Kind::ProtocolList ||
631
- node->getKind () == Node::Kind::ProtocolListWithClass);
633
+ node->getKind () == Node::Kind::ProtocolListWithClass ||
634
+ node->getKind () == Node::Kind::ProtocolListWithAnyObject);
632
635
}
633
636
634
637
// / Print the relevant parameters and return the new index.
@@ -1362,7 +1365,10 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) {
1362
1365
NodePointer superclass = Node->getChild (1 );
1363
1366
print (superclass);
1364
1367
Printer << " & " ;
1365
- printChildren (protocols, " & " );
1368
+ if (protocols->getNumChildren () < 1 )
1369
+ return nullptr ;
1370
+ NodePointer type_list = protocols->getChild (0 );
1371
+ printChildren (type_list, " & " );
1366
1372
return nullptr ;
1367
1373
}
1368
1374
case Node::Kind::ProtocolListWithAnyObject: {
@@ -1371,12 +1377,14 @@ NodePointer NodePrinter::print(NodePointer Node, bool asPrefixContext) {
1371
1377
NodePointer protocols = Node->getChild (0 );
1372
1378
if (protocols->getNumChildren () < 1 )
1373
1379
return nullptr ;
1374
- if (protocols->getChild (0 )->getNumChildren () == 0 ) {
1375
- Printer << " AnyObject" ;
1376
- } else {
1377
- printChildren (protocols->getChild (0 ), " & " );
1378
- Printer << " & AnyObject" ;
1380
+ NodePointer type_list = protocols->getChild (0 );
1381
+ if (type_list->getNumChildren () > 0 ) {
1382
+ printChildren (type_list, " & " );
1383
+ Printer << " & " ;
1379
1384
}
1385
+ if (Options.QualifyEntities )
1386
+ Printer << " Swift." ;
1387
+ Printer << " AnyObject" ;
1380
1388
return nullptr ;
1381
1389
}
1382
1390
case Node::Kind::AssociatedType:
0 commit comments