mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Sourcekit/Evaluator: refactor cursor-info resolver to using the evaluator model. NFC
This change adds a new IDE request ID zone and refactors the cursor-info resolver to use the request evaluator model.
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "swift/IDE/SourceEntityWalker.h"
|
||||
#include "swift/IDE/Utils.h"
|
||||
#include "swift/IDE/Refactoring.h"
|
||||
#include "swift/IDE/IDERequests.h"
|
||||
#include "swift/Markup/XMLUtils.h"
|
||||
#include "swift/Sema/IDETypeChecking.h"
|
||||
|
||||
@@ -1315,8 +1316,12 @@ static void resolveCursor(SwiftLangSupport &Lang,
|
||||
// info request to get the available rename kinds.
|
||||
}
|
||||
|
||||
CursorInfoResolver Resolver(AstUnit->getPrimarySourceFile());
|
||||
ResolvedCursorInfo CursorInfo = Resolver.resolve(Loc);
|
||||
auto *File = &AstUnit->getPrimarySourceFile();
|
||||
ResolvedCursorInfo CursorInfo =
|
||||
evaluateOrDefault(File->getASTContext().evaluator,
|
||||
CursorInfoRequest{CursorInfoOwner(File, Loc)},
|
||||
ResolvedCursorInfo());
|
||||
|
||||
if (CursorInfo.isInvalid()) {
|
||||
CursorInfoData Info;
|
||||
Info.InternalDiagnostic = "Unable to resolve cursor info.";
|
||||
@@ -1460,8 +1465,11 @@ static void resolveName(SwiftLangSupport &Lang, StringRef InputFile,
|
||||
return;
|
||||
}
|
||||
|
||||
CursorInfoResolver Resolver(AstUnit->getPrimarySourceFile());
|
||||
ResolvedCursorInfo CursorInfo = Resolver.resolve(Loc);
|
||||
auto *File = &AstUnit->getPrimarySourceFile();
|
||||
ResolvedCursorInfo CursorInfo =
|
||||
evaluateOrDefault(File->getASTContext().evaluator,
|
||||
CursorInfoRequest{CursorInfoOwner(File, Loc)},
|
||||
ResolvedCursorInfo());
|
||||
if (CursorInfo.isInvalid()) {
|
||||
NameTranslatingInfo Info;
|
||||
Info.InternalDiagnostic = "Unable to resolve cursor info.";
|
||||
@@ -2009,8 +2017,10 @@ void SwiftLangSupport::findRelatedIdentifiersInFile(
|
||||
if (Loc.isInvalid())
|
||||
return;
|
||||
|
||||
CursorInfoResolver Resolver(SrcFile);
|
||||
ResolvedCursorInfo CursorInfo = Resolver.resolve(Loc);
|
||||
ResolvedCursorInfo CursorInfo =
|
||||
evaluateOrDefault(SrcFile.getASTContext().evaluator,
|
||||
CursorInfoRequest{CursorInfoOwner(&SrcFile, Loc)},
|
||||
ResolvedCursorInfo());
|
||||
if (CursorInfo.isInvalid())
|
||||
return;
|
||||
if (CursorInfo.IsKeywordArgument)
|
||||
|
||||
Reference in New Issue
Block a user