@@ -549,42 +549,46 @@ ProjectionPath::removePrefix(const ProjectionPath &Path,
549549}
550550
551551void Projection::print (raw_ostream &os, SILType baseType) const {
552- if (isNominalKind ()) {
552+ switch (getKind ()) {
553+ case ProjectionKind::Struct:
554+ case ProjectionKind::Class: {
553555 auto *Decl = getVarDecl (baseType);
554556 os << " Field: " ;
555557 Decl->print (os);
556- return ;
557- }
558-
559- if (getKind () == ProjectionKind::Tuple) {
560- os << " Index: " << getIndex ();
561- return ;
558+ break ;
562559 }
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 ;
566565 }
567- if (getKind () == ProjectionKind::Index) {
566+ case ProjectionKind::Index:
567+ case ProjectionKind::Tuple: {
568568 os << " Index: " << getIndex ();
569- return ;
569+ break ;
570+ }
571+ case ProjectionKind::Box: {
572+ os << " Box over" ;
573+ break ;
570574 }
571- if ( getKind () == ProjectionKind::Upcast) {
575+ case ProjectionKind::Upcast: {
572576 os << " UpCast" ;
573- return ;
577+ break ;
574578 }
575- if ( getKind () == ProjectionKind::RefCast) {
579+ case ProjectionKind::RefCast: {
576580 os << " RefCast" ;
577- return ;
581+ break ;
578582 }
579- if ( getKind () == ProjectionKind::Box) {
580- os << " Box over " ;
581- return ;
583+ case ProjectionKind::BitwiseCast: {
584+ os << " BitwiseCast " ;
585+ break ;
582586 }
583- if ( getKind () == ProjectionKind::TailElems) {
587+ case ProjectionKind::TailElems: {
584588 os << " TailElems" ;
585- return ;
589+ break ;
590+ }
586591 }
587- os << " <unexpected projection>" ;
588592}
589593
590594raw_ostream &ProjectionPath::print (raw_ostream &os, SILModule &M,
0 commit comments