[Distributed] implement adhoc requirements properly for Encoder

This commit is contained in:
Konrad `ktoso` Malawski
2022-02-14 16:14:41 +09:00
parent 0fec1b31da
commit 005743c92c
11 changed files with 596 additions and 147 deletions

View File

@@ -80,40 +80,6 @@ static VarDecl *addImplicitDistributedActorIDProperty(
return propDecl;
}
/******************************************************************************/
/************ LOCATING AD-HOC PROTOCOL REQUIREMENT IMPLS **********************/
/******************************************************************************/
AbstractFunctionDecl*
GetDistributedActorSystemRemoteCallFunctionRequest::evaluate(
Evaluator &evaluator, NominalTypeDecl *decl, bool isVoidReturn) const {
auto &C = decl->getASTContext();
// It would be nice to check if this is a DistributedActorSystem
// "conforming" type, but we can't do this as we invoke this function WHILE
// deciding if the type conforms or not;
// Not via `ensureDistributedModuleLoaded` to avoid generating a warning,
// we won't be emitting the offending decl after all.
if (!C.getLoadedModule(C.Id_Distributed)) {
return nullptr;
}
auto callId = isVoidReturn ? C.Id_remoteCallVoid : C.Id_remoteCall;
AbstractFunctionDecl *remoteCallFunc = nullptr;
for (auto value : decl->lookupDirect(callId)) {
auto func = dyn_cast<AbstractFunctionDecl>(value);
if (func && func->isDistributedActorSystemRemoteCall(isVoidReturn)) {
remoteCallFunc = func;
break;
}
}
return remoteCallFunc;
}
/******************************************************************************/
/************************ SYNTHESIS ENTRY POINT *******************************/
/******************************************************************************/