@@ -549,42 +549,46 @@ ProjectionPath::removePrefix(const ProjectionPath &Path,
549
549
}
550
550
551
551
void Projection::print (raw_ostream &os, SILType baseType) const {
552
- if (isNominalKind ()) {
552
+ switch (getKind ()) {
553
+ case ProjectionKind::Struct:
554
+ case ProjectionKind::Class: {
553
555
auto *Decl = getVarDecl (baseType);
554
556
os << " Field: " ;
555
557
Decl->print (os);
556
- return ;
557
- }
558
-
559
- if (getKind () == ProjectionKind::Tuple) {
560
- os << " Index: " << getIndex ();
561
- return ;
558
+ break ;
562
559
}
563
- if (getKind () == ProjectionKind::BitwiseCast) {
564
- os << " BitwiseCast" ;
565
- return ;
560
+ case ProjectionKind::Enum: {
561
+ auto *Decl = getEnumElementDecl (baseType);
562
+ os << " Enum: " ;
563
+ Decl->print (os);
564
+ break ;
566
565
}
567
- if (getKind () == ProjectionKind::Index) {
566
+ case ProjectionKind::Index:
567
+ case ProjectionKind::Tuple: {
568
568
os << " Index: " << getIndex ();
569
- return ;
569
+ break ;
570
+ }
571
+ case ProjectionKind::Box: {
572
+ os << " Box over" ;
573
+ break ;
570
574
}
571
- if ( getKind () == ProjectionKind::Upcast) {
575
+ case ProjectionKind::Upcast: {
572
576
os << " UpCast" ;
573
- return ;
577
+ break ;
574
578
}
575
- if ( getKind () == ProjectionKind::RefCast) {
579
+ case ProjectionKind::RefCast: {
576
580
os << " RefCast" ;
577
- return ;
581
+ break ;
578
582
}
579
- if ( getKind () == ProjectionKind::Box) {
580
- os << " Box over " ;
581
- return ;
583
+ case ProjectionKind::BitwiseCast: {
584
+ os << " BitwiseCast " ;
585
+ break ;
582
586
}
583
- if ( getKind () == ProjectionKind::TailElems) {
587
+ case ProjectionKind::TailElems: {
584
588
os << " TailElems" ;
585
- return ;
589
+ break ;
590
+ }
586
591
}
587
- os << " <unexpected projection>" ;
588
592
}
589
593
590
594
raw_ostream &ProjectionPath::print (raw_ostream &os, SILModule &M,
0 commit comments