mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #70983 from hamishknight/another-cleanup
[AST] Remove SerializedLocalDeclContext
This commit is contained in:
@@ -2057,7 +2057,8 @@ void Serializer::writeCrossReference(const DeclContext *DC, uint32_t pathLen) {
|
||||
case DeclContextKind::AbstractClosureExpr:
|
||||
case DeclContextKind::Initializer:
|
||||
case DeclContextKind::TopLevelCodeDecl:
|
||||
case DeclContextKind::SerializedLocal:
|
||||
case DeclContextKind::SerializedAbstractClosure:
|
||||
case DeclContextKind::SerializedTopLevelCodeDecl:
|
||||
case DeclContextKind::EnumElementDecl:
|
||||
case DeclContextKind::MacroDecl:
|
||||
llvm_unreachable("cannot cross-reference this context");
|
||||
@@ -2473,6 +2474,15 @@ void Serializer::writeASTBlockEntity(const DeclContext *DC) {
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclContextKind::SerializedAbstractClosure: {
|
||||
// We're merging an already serialized module, handle the same as a
|
||||
// regular AbstractClosureExpr.
|
||||
auto *SACE = cast<SerializedAbstractClosureExpr>(DC);
|
||||
writeAbstractClosureExpr(SACE->getParent(), SACE->getType(),
|
||||
SACE->isImplicit(), SACE->getDiscriminator());
|
||||
return;
|
||||
}
|
||||
|
||||
case DeclContextKind::Initializer: {
|
||||
if (auto PBI = dyn_cast<PatternBindingInitializer>(DC)) {
|
||||
writePatternBindingInitializer(PBI->getBinding(), PBI->getBindingIndex());
|
||||
@@ -2482,33 +2492,14 @@ void Serializer::writeASTBlockEntity(const DeclContext *DC) {
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclContextKind::TopLevelCodeDecl: {
|
||||
case DeclContextKind::TopLevelCodeDecl:
|
||||
case DeclContextKind::SerializedTopLevelCodeDecl: {
|
||||
auto abbrCode = DeclTypeAbbrCodes[TopLevelCodeDeclContextLayout::Code];
|
||||
TopLevelCodeDeclContextLayout::emitRecord(Out, ScratchRecord, abbrCode,
|
||||
addDeclContextRef(DC->getParent()).getOpaqueValue());
|
||||
break;
|
||||
}
|
||||
|
||||
// If we are merging already serialized modules with local decl contexts,
|
||||
// we handle them here in a similar fashion.
|
||||
case DeclContextKind::SerializedLocal: {
|
||||
auto local = cast<SerializedLocalDeclContext>(DC);
|
||||
switch (local->getLocalDeclContextKind()) {
|
||||
case LocalDeclContextKind::AbstractClosure: {
|
||||
auto SACE = cast<SerializedAbstractClosureExpr>(local);
|
||||
writeAbstractClosureExpr(SACE->getParent(), SACE->getType(),
|
||||
SACE->isImplicit(), SACE->getDiscriminator());
|
||||
return;
|
||||
}
|
||||
case LocalDeclContextKind::TopLevelCodeDecl: {
|
||||
auto abbrCode = DeclTypeAbbrCodes[TopLevelCodeDeclContextLayout::Code];
|
||||
TopLevelCodeDeclContextLayout::emitRecord(Out, ScratchRecord,
|
||||
abbrCode, addDeclContextRef(DC->getParent()).getOpaqueValue());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
llvm_unreachable("Trying to write a DeclContext that isn't local");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user