mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Code completion: basic completion in constructor bodies
Swift SVN r8338
This commit is contained in:
@@ -369,17 +369,22 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks,
|
||||
SourceLoc EndTypeCheckLoc =
|
||||
ParsedExpr ? ParsedExpr->getStartLoc()
|
||||
: TU->Ctx.SourceMgr.getCodeCompletionLoc();
|
||||
// FIXME: constructors and destructors.
|
||||
// FIXME: closures.
|
||||
// For now, just find the nearest outer function.
|
||||
DeclContext *DCToTypeCheck = CurDeclContext;
|
||||
while (!DCToTypeCheck->isModuleContext() &&
|
||||
!isa<AbstractFunctionDecl>(DCToTypeCheck))
|
||||
DCToTypeCheck = DCToTypeCheck->getParent();
|
||||
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(DCToTypeCheck))
|
||||
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(DCToTypeCheck)) {
|
||||
if (auto *FD = dyn_cast<FuncDecl>(AFD))
|
||||
return typeCheckFunctionBodyUntil(TU, CurDeclContext, FD,
|
||||
EndTypeCheckLoc);
|
||||
if (isa<ConstructorDecl>(AFD) || isa<DestructorDecl>(AFD)) {
|
||||
// FIXME: constructors and destructors.
|
||||
// Just return success until we can type check these.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (CurDeclContext->getContextKind() == DeclContextKind::NominalTypeDecl) {
|
||||
|
||||
Reference in New Issue
Block a user