mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialize] Serialize foreign async conventions.
Fixes rdar://73476584.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "swift/AST/DiagnosticsCommon.h"
|
||||
#include "swift/AST/Expr.h"
|
||||
#include "swift/AST/FileSystem.h"
|
||||
#include "swift/AST/ForeignAsyncConvention.h"
|
||||
#include "swift/AST/ForeignErrorConvention.h"
|
||||
#include "swift/AST/GenericEnvironment.h"
|
||||
#include "swift/AST/IndexSubset.h"
|
||||
@@ -2693,6 +2694,18 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
|
||||
resultTypeID);
|
||||
}
|
||||
|
||||
void writeForeignAsyncConvention(const ForeignAsyncConvention &fac) {
|
||||
using namespace decls_block;
|
||||
TypeID completionHandlerTypeID = S.addTypeRef(fac.completionHandlerType());
|
||||
unsigned rawErrorParameterIndex = fac.completionHandlerErrorParamIndex()
|
||||
.map([](unsigned index) { return index + 1; }).getValueOr(0);
|
||||
auto abbrCode = S.DeclTypeAbbrCodes[ForeignAsyncConventionLayout::Code];
|
||||
ForeignAsyncConventionLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,
|
||||
completionHandlerTypeID,
|
||||
fac.completionHandlerParamIndex(),
|
||||
rawErrorParameterIndex);
|
||||
}
|
||||
|
||||
void writeGenericParams(const GenericParamList *genericParams) {
|
||||
using namespace decls_block;
|
||||
|
||||
@@ -3590,6 +3603,8 @@ public:
|
||||
|
||||
if (auto errorConvention = fn->getForeignErrorConvention())
|
||||
writeForeignErrorConvention(*errorConvention);
|
||||
if (auto asyncConvention = fn->getForeignAsyncConvention())
|
||||
writeForeignAsyncConvention(*asyncConvention);
|
||||
|
||||
writeInlinableBodyTextIfNeeded(fn);
|
||||
}
|
||||
@@ -3671,6 +3686,8 @@ public:
|
||||
|
||||
if (auto errorConvention = fn->getForeignErrorConvention())
|
||||
writeForeignErrorConvention(*errorConvention);
|
||||
if (auto asyncConvention = fn->getForeignAsyncConvention())
|
||||
writeForeignAsyncConvention(*asyncConvention);
|
||||
|
||||
writeInlinableBodyTextIfNeeded(fn);
|
||||
}
|
||||
@@ -3825,6 +3842,8 @@ public:
|
||||
|
||||
if (auto errorConvention = ctor->getForeignErrorConvention())
|
||||
writeForeignErrorConvention(*errorConvention);
|
||||
if (auto asyncConvention = ctor->getForeignAsyncConvention())
|
||||
writeForeignAsyncConvention(*asyncConvention);
|
||||
|
||||
writeInlinableBodyTextIfNeeded(ctor);
|
||||
}
|
||||
@@ -4669,6 +4688,7 @@ void Serializer::writeAllDeclsAndTypes() {
|
||||
registerDeclTypeAbbr<SubstitutionMapLayout>();
|
||||
|
||||
registerDeclTypeAbbr<ForeignErrorConventionLayout>();
|
||||
registerDeclTypeAbbr<ForeignAsyncConventionLayout>();
|
||||
registerDeclTypeAbbr<AbstractClosureExprLayout>();
|
||||
registerDeclTypeAbbr<PatternBindingInitializerLayout>();
|
||||
registerDeclTypeAbbr<DefaultArgumentInitializerLayout>();
|
||||
|
||||
Reference in New Issue
Block a user