@@ -342,7 +342,8 @@ SourceFile *DeclContext::getParentSourceFile() const {
342342 case DeclContextKind::FileUnit:
343343 case DeclContextKind::Module:
344344 case DeclContextKind::Package:
345- case DeclContextKind::SerializedLocal:
345+ case DeclContextKind::SerializedAbstractClosure:
346+ case DeclContextKind::SerializedTopLevelCodeDecl:
346347 break ;
347348 }
348349 }
@@ -613,7 +614,8 @@ bool DeclContext::walkContext(ASTWalker &Walker) {
613614 return cast<EnumElementDecl>(this )->walk (Walker);
614615 case DeclContextKind::MacroDecl:
615616 return cast<MacroDecl>(this )->walk (Walker);
616- case DeclContextKind::SerializedLocal:
617+ case DeclContextKind::SerializedAbstractClosure:
618+ case DeclContextKind::SerializedTopLevelCodeDecl:
617619 llvm_unreachable (" walk is unimplemented for deserialized contexts" );
618620 case DeclContextKind::Initializer:
619621 // Is there any point in trying to walk the expression?
@@ -689,10 +691,12 @@ unsigned DeclContext::printContext(raw_ostream &OS, const unsigned indent,
689691 case DeclContextKind::Package: Kind = " Package" ; break ;
690692 case DeclContextKind::Module: Kind = " Module" ; break ;
691693 case DeclContextKind::FileUnit: Kind = " FileUnit" ; break ;
692- case DeclContextKind::SerializedLocal: Kind = " Serialized Local" ; break ;
693694 case DeclContextKind::AbstractClosureExpr:
694695 Kind = " AbstractClosureExpr" ;
695696 break ;
697+ case DeclContextKind::SerializedAbstractClosure:
698+ Kind = " SerializedAbstractClosure" ;
699+ break ;
696700 case DeclContextKind::GenericTypeDecl:
697701 switch (cast<GenericTypeDecl>(this )->getKind ()) {
698702#define DECL (ID, PARENT ) \
@@ -702,6 +706,9 @@ unsigned DeclContext::printContext(raw_ostream &OS, const unsigned indent,
702706 break ;
703707 case DeclContextKind::ExtensionDecl: Kind = " ExtensionDecl" ; break ;
704708 case DeclContextKind::TopLevelCodeDecl: Kind = " TopLevelCodeDecl" ; break ;
709+ case DeclContextKind::SerializedTopLevelCodeDecl:
710+ Kind = " SerializedTopLevelCodeDecl" ;
711+ break ;
705712 case DeclContextKind::Initializer: Kind = " Initializer" ; break ;
706713 case DeclContextKind::AbstractFunctionDecl:
707714 Kind = " AbstractFunctionDecl" ;
@@ -741,16 +748,29 @@ unsigned DeclContext::printContext(raw_ostream &OS, const unsigned indent,
741748 OS << " line=" << getLineNumber (cast<AbstractClosureExpr>(this ));
742749 OS << " : " << cast<AbstractClosureExpr>(this )->getType ();
743750 break ;
751+
752+ case DeclContextKind::SerializedAbstractClosure: {
753+ OS << " : " << cast<SerializedAbstractClosureExpr>(this )->getType ();
754+ break ;
755+ }
756+
744757 case DeclContextKind::GenericTypeDecl:
745758 OS << " name=" << cast<GenericTypeDecl>(this )->getName ();
746759 break ;
760+
747761 case DeclContextKind::ExtensionDecl:
748762 OS << " line=" << getLineNumber (cast<ExtensionDecl>(this ));
749763 OS << " base=" << cast<ExtensionDecl>(this )->getExtendedType ();
750764 break ;
765+
751766 case DeclContextKind::TopLevelCodeDecl:
752767 OS << " line=" << getLineNumber (cast<TopLevelCodeDecl>(this ));
753768 break ;
769+
770+ case DeclContextKind::SerializedTopLevelCodeDecl:
771+ // Already printed the kind, nothing else to do.
772+ break ;
773+
754774 case DeclContextKind::AbstractFunctionDecl: {
755775 auto *AFD = cast<AbstractFunctionDecl>(this );
756776 OS << " name=" << AFD->getName ();
@@ -815,20 +835,6 @@ unsigned DeclContext::printContext(raw_ostream &OS, const unsigned indent,
815835 }
816836 }
817837 break ;
818-
819- case DeclContextKind::SerializedLocal: {
820- auto local = cast<SerializedLocalDeclContext>(this );
821- switch (local->getLocalDeclContextKind ()) {
822- case LocalDeclContextKind::AbstractClosure: {
823- auto serializedClosure = cast<SerializedAbstractClosureExpr>(local);
824- OS << " closure : " << serializedClosure->getType ();
825- break ;
826- }
827- case LocalDeclContextKind::TopLevelCodeDecl:
828- OS << " TopLevelCode" ;
829- break ;
830- }
831- }
832838 }
833839
834840 if (auto decl = getAsDecl ())
@@ -1308,8 +1314,10 @@ DeclContextKind DeclContext::getContextKind() const {
13081314 return DeclContextKind::AbstractClosureExpr;
13091315 case ASTHierarchy::Initializer:
13101316 return DeclContextKind::Initializer;
1311- case ASTHierarchy::SerializedLocal:
1312- return DeclContextKind::SerializedLocal;
1317+ case ASTHierarchy::SerializedAbstractClosure:
1318+ return DeclContextKind::SerializedAbstractClosure;
1319+ case ASTHierarchy::SerializedTopLevelCodeDecl:
1320+ return DeclContextKind::SerializedTopLevelCodeDecl;
13131321 case ASTHierarchy::FileUnit:
13141322 return DeclContextKind::FileUnit;
13151323 case ASTHierarchy::Package:
@@ -1362,7 +1370,8 @@ bool DeclContext::isAsyncContext() const {
13621370 case DeclContextKind::Initializer:
13631371 case DeclContextKind::EnumElementDecl:
13641372 case DeclContextKind::ExtensionDecl:
1365- case DeclContextKind::SerializedLocal:
1373+ case DeclContextKind::SerializedAbstractClosure:
1374+ case DeclContextKind::SerializedTopLevelCodeDecl:
13661375 case DeclContextKind::Package:
13671376 case DeclContextKind::Module:
13681377 case DeclContextKind::GenericTypeDecl:
@@ -1414,7 +1423,8 @@ SourceLoc swift::extractNearestSourceLoc(const DeclContext *dc) {
14141423 return SourceLoc ();
14151424
14161425 case DeclContextKind::Initializer:
1417- case DeclContextKind::SerializedLocal:
1426+ case DeclContextKind::SerializedAbstractClosure:
1427+ case DeclContextKind::SerializedTopLevelCodeDecl:
14181428 return extractNearestSourceLoc (dc->getParent ());
14191429 }
14201430 llvm_unreachable (" Unhandled DeclContextKindIn switch" );
0 commit comments