RequestResult class and Pass*InfoForDecl fixes

This commit is contained in:
David Goldman
2019-05-03 15:17:40 -04:00
parent 1b1756cb55
commit cb14b8b535
10 changed files with 352 additions and 285 deletions

View File

@@ -834,8 +834,7 @@ void SwiftLangSupport::editorOpenHeaderInterface(EditorConsumer &Consumer,
void SwiftLangSupport::findInterfaceDocument(StringRef ModuleName,
ArrayRef<const char *> Args,
std::function<void(const InterfaceDocInfo &,
StringRef Error)> Receiver) {
std::function<void(const RequestResult<InterfaceDocInfo> &)> Receiver) {
InterfaceDocInfo Info;
CompilerInstance CI;
@@ -847,7 +846,7 @@ void SwiftLangSupport::findInterfaceDocument(StringRef ModuleName,
std::string Error;
if (getASTManager()->initCompilerInvocation(Invocation, Args, CI.getDiags(),
StringRef(), Error)) {
return Receiver({}, Error);
return Receiver(RequestResult<InterfaceDocInfo>::fromError(Error));
}
if (auto IFaceGenRef = IFaceGenContexts.find(ModuleName, Invocation))
@@ -905,5 +904,5 @@ void SwiftLangSupport::findInterfaceDocument(StringRef ModuleName,
}
Info.CompilerArgs = NewArgs;
return Receiver(Info, "");
return Receiver(RequestResult<InterfaceDocInfo>::fromResult(Info));
}