mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
IDE: Always use the right DeclContext
We have a hack where we use the ParsedDecl as the DeclContext, to handle completion during function signature parsing, which happens before the FuncDecl has been created. While fixing this properly would require a bigger change to the parser and AST, for now we just check if the ParsedDecl is a child context of CurDeclContext, and only use it then.
This commit is contained in:
@@ -5121,8 +5121,10 @@ void CodeCompletionCallbacksImpl::doneParsing() {
|
||||
if (ParsedDecl && !typecheckParsedDecl())
|
||||
return;
|
||||
|
||||
if (auto *DC = dyn_cast_or_null<DeclContext>(ParsedDecl))
|
||||
CurDeclContext = DC;
|
||||
if (auto *DC = dyn_cast_or_null<DeclContext>(ParsedDecl)) {
|
||||
if (DC->isChildContextOf(CurDeclContext))
|
||||
CurDeclContext = DC;
|
||||
}
|
||||
|
||||
Optional<Type> ExprType;
|
||||
ConcreteDeclRef ReferencedDecl = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user