Skip to content

Commit 2245df5

Browse files
committed
Serialization: Adopt new AvailableAttr constructor.
1 parent 73c2c66 commit 2245df5

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

lib/Serialization/Deserialization.cpp

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5619,27 +5619,31 @@ DeclDeserializer::readAvailable_DECL_ATTR(SmallVectorImpl<uint64_t> &scratch,
56195619
DECODE_VER_TUPLE(Deprecated)
56205620
DECODE_VER_TUPLE(Obsoleted)
56215621

5622-
PlatformAgnosticAvailabilityKind platformAgnostic;
5622+
AvailableAttr::Kind kind;
56235623
if (isUnavailable)
5624-
platformAgnostic = PlatformAgnosticAvailabilityKind::Unavailable;
5624+
kind = AvailableAttr::Kind::Unavailable;
56255625
else if (isDeprecated)
5626-
platformAgnostic = PlatformAgnosticAvailabilityKind::Deprecated;
5626+
kind = AvailableAttr::Kind::Deprecated;
56275627
else if (isNoAsync)
5628-
platformAgnostic = PlatformAgnosticAvailabilityKind::NoAsync;
5629-
else if (platform == PlatformKind::none &&
5630-
(!Introduced.empty() || !Deprecated.empty() || !Obsoleted.empty()))
5631-
platformAgnostic =
5632-
isPackageDescriptionVersionSpecific
5633-
? PlatformAgnosticAvailabilityKind::
5634-
PackageDescriptionVersionSpecific
5635-
: PlatformAgnosticAvailabilityKind::SwiftVersionSpecific;
5628+
kind = AvailableAttr::Kind::NoAsync;
56365629
else
5637-
platformAgnostic = PlatformAgnosticAvailabilityKind::None;
5630+
kind = AvailableAttr::Kind::Default;
5631+
5632+
AvailabilityDomain domain;
5633+
if (platform != PlatformKind::none) {
5634+
domain = AvailabilityDomain::forPlatform(platform);
5635+
} else if (!Introduced.empty() || !Deprecated.empty() || !Obsoleted.empty()) {
5636+
domain = isPackageDescriptionVersionSpecific
5637+
? AvailabilityDomain::forPackageDescription()
5638+
: AvailabilityDomain::forSwiftLanguage();
5639+
} else {
5640+
domain = AvailabilityDomain::forUniversal();
5641+
}
56385642

5639-
auto attr = new (ctx) AvailableAttr(
5640-
SourceLoc(), SourceRange(), platform, message, rename, Introduced,
5641-
SourceRange(), Deprecated, SourceRange(), Obsoleted, SourceRange(),
5642-
platformAgnostic, isImplicit, isSPI, isForEmbedded);
5643+
auto attr = new (ctx)
5644+
AvailableAttr(SourceLoc(), SourceRange(), domain, kind, message, rename,
5645+
Introduced, SourceRange(), Deprecated, SourceRange(),
5646+
Obsoleted, SourceRange(), isImplicit, isSPI, isForEmbedded);
56435647
return attr;
56445648
}
56455649

0 commit comments

Comments
 (0)