mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[serialization] Add support for [conversion] methods.
Take advantage of the fact that a function can never be both a conversion method and an assignment operator to pack both flags into the same bit in the serialized record. Swift SVN r6185
This commit is contained in:
@@ -672,13 +672,13 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
|
||||
DeclID contextID;
|
||||
bool isImplicit;
|
||||
bool isClassMethod;
|
||||
bool isAssignment;
|
||||
bool isAssignmentOrConversion;
|
||||
TypeID signatureID;
|
||||
DeclID associatedDeclID;
|
||||
DeclID overriddenID;
|
||||
|
||||
decls_block::FuncLayout::readRecord(scratch, nameID, contextID, isImplicit,
|
||||
isClassMethod, isAssignment,
|
||||
isClassMethod, isAssignmentOrConversion,
|
||||
signatureID, associatedDeclID,
|
||||
overriddenID);
|
||||
|
||||
@@ -738,8 +738,12 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
|
||||
fn->setStatic(isClassMethod);
|
||||
if (isImplicit)
|
||||
fn->setImplicit();
|
||||
if (isAssignment)
|
||||
fn->getMutableAttrs().Assignment = isAssignment;
|
||||
if (isAssignmentOrConversion) {
|
||||
if (fn->isOperator())
|
||||
fn->getMutableAttrs().Assignment = true;
|
||||
else
|
||||
fn->getMutableAttrs().Conversion = true;
|
||||
}
|
||||
|
||||
if (Decl *associated = getDecl(associatedDeclID)) {
|
||||
if (auto op = dyn_cast<OperatorDecl>(associated)) {
|
||||
|
||||
Reference in New Issue
Block a user