mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[serialization] Handle @transparent on constructors and extensions as well.
Thanks for catching this, Dmitri and Joe. Swift SVN r9354
This commit is contained in:
@@ -944,15 +944,15 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext,
|
||||
|
||||
case decls_block::CONSTRUCTOR_DECL: {
|
||||
DeclID parentID;
|
||||
bool isImplicit, hasSelectorStyleSignature, isObjC;
|
||||
bool isImplicit, hasSelectorStyleSignature, isObjC, isTransparent;
|
||||
TypeID signatureID;
|
||||
TypeID interfaceID;
|
||||
DeclID implicitSelfID;
|
||||
|
||||
decls_block::ConstructorLayout::readRecord(scratch, parentID, isImplicit,
|
||||
hasSelectorStyleSignature,
|
||||
isObjC, signatureID,
|
||||
interfaceID,
|
||||
isObjC, isTransparent,
|
||||
signatureID, interfaceID,
|
||||
implicitSelfID);
|
||||
auto parent = getDeclContext(parentID);
|
||||
if (declOrOffset.isComplete())
|
||||
@@ -1026,6 +1026,8 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext,
|
||||
if (hasSelectorStyleSignature)
|
||||
ctor->setHasSelectorStyleSignature();
|
||||
ctor->setIsObjC(isObjC);
|
||||
if (isTransparent)
|
||||
ctor->getMutableAttrs().setAttr(AK_transparent, SourceLoc());
|
||||
|
||||
if (genericParams)
|
||||
for (auto &genericParam : *ctor->getGenericParams())
|
||||
|
||||
@@ -625,6 +625,7 @@ namespace decls_block {
|
||||
BCFixed<1>, // implicit?
|
||||
BCFixed<1>, // has selector-style signature?
|
||||
BCFixed<1>, // objc?
|
||||
BCFixed<1>, // transparent?
|
||||
TypeIDField, // type (signature)
|
||||
TypeIDField, // type (interface)
|
||||
DeclIDField // implicit this decl
|
||||
@@ -654,7 +655,7 @@ namespace decls_block {
|
||||
BCFixed<1>, // class method?
|
||||
BCFixed<1>, // assignment? / conversion?
|
||||
BCFixed<1>, // explicitly objc?
|
||||
BCFixed<1>, // iboutlet?
|
||||
BCFixed<1>, // ibaction?
|
||||
BCFixed<1>, // transparent?
|
||||
BCVBR<5>, // number of parameter patterns
|
||||
TypeIDField, // type (signature)
|
||||
|
||||
@@ -943,6 +943,12 @@ void Serializer::writeDecl(const Decl *D) {
|
||||
case DeclKind::Extension: {
|
||||
auto extension = cast<ExtensionDecl>(D);
|
||||
|
||||
DeclAttributes remainingAttrs = extension->getAttrs();
|
||||
// @transparent on extensions is propagated down to the methods and
|
||||
// constructors during serialization.
|
||||
remainingAttrs.clearAttribute(AK_transparent);
|
||||
assert(remainingAttrs.empty() && "unhandled extension attrs");
|
||||
|
||||
const Decl *DC = getDeclForContext(extension->getDeclContext());
|
||||
Type baseTy = extension->getExtendedType();
|
||||
|
||||
@@ -1260,7 +1266,7 @@ void Serializer::writeDecl(const Decl *D) {
|
||||
fn->getAttrs().isConversion(),
|
||||
fn->isObjC(),
|
||||
fn->getAttrs().isIBAction(),
|
||||
fn->getAttrs().isTransparent(),
|
||||
fn->isTransparent(),
|
||||
fn->getArgParamPatterns().size(),
|
||||
addTypeRef(fn->getType()),
|
||||
addTypeRef(fn->getInterfaceType()),
|
||||
@@ -1345,6 +1351,7 @@ void Serializer::writeDecl(const Decl *D) {
|
||||
ctor->isImplicit(),
|
||||
ctor->hasSelectorStyleSignature(),
|
||||
ctor->isObjC(),
|
||||
ctor->isTransparent(),
|
||||
addTypeRef(ctor->getType()),
|
||||
addTypeRef(ctor->getInterfaceType()),
|
||||
addDeclRef(implicitSelf));
|
||||
|
||||
Reference in New Issue
Block a user