[serialization] Handle computed properties with a getter /and/ setter.

Since accessor FuncDecl have a backreference to the VarDecl they are
attached to, we were getting re-entrant deserialization issues. Fix
this by just not serializing the backreference and relying on the
property being deserialized first.

Swift SVN r6134
This commit is contained in:
Jordan Rose
2013-07-10 23:25:39 +00:00
parent 9a67bc597e
commit b4fe4f098c
3 changed files with 3 additions and 22 deletions

View File

@@ -735,24 +735,8 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext) {
else if (isa<PostfixOperatorDecl>(op))
attrs.ExplicitPostfix = true;
// Note that an explicit [infix] is not required.
} else {
bool isGetter = false;
if (auto subscript = dyn_cast<SubscriptDecl>(associated)) {
isGetter = (subscript->getGetter() == fn);
assert(isGetter || subscript->getSetter() == fn);
} else if (auto var = dyn_cast<VarDecl>(associated)) {
isGetter = (var->getGetter() == fn);
assert(isGetter || var->getSetter() == fn);
} else {
llvm_unreachable("unknown associated decl kind");
}
if (isGetter)
fn->makeGetter(associated);
else
fn->makeSetter(associated);
}
// Otherwise, unknown associated decl kind.
}
break;