Part of the fix for rdar://problem/18677108 (tests and more changes go to SourceKit). The swift’s part handles the cases when an implicit accessor was created, but its body is not synthesized; e.g. in case the owning PatternBindingDecl is invalid.

Swift SVN r23037
This commit is contained in:
Denis Vnukov
2014-10-31 21:41:01 +00:00
parent f016754ef9
commit 995f365bdb

View File

@@ -162,7 +162,12 @@ bool SemaAnnotator::walkToDeclPost(Decl *D) {
if (VD->getAttrs().hasAttribute<LazyAttr>()) {
if (auto *Get = VD->getGetter()) {
assert(Get->isImplicit() && "lazy var not implicitly computed");
Get->getBody()->walk(*this);
// Note that an implicit getter may not have the body synthesized
// in case the owning PatternBindingDecl is invalid
if(auto *Body = Get->getBody()) {
Body->walk(*this);
}
}
}
}