[Distributed] Guard ID synthesis from synthesizing the property multiple times; e.g. during multi module builds

This commit is contained in:
Konrad `ktoso` Malawski
2022-04-22 23:17:23 +09:00
parent 1b8c4305eb
commit 317fdd0740
6 changed files with 114 additions and 22 deletions

View File

@@ -737,6 +737,13 @@ VarDecl *GetDistributedActorIDPropertyRequest::evaluate(
if (!classDecl)
return nullptr;
// We may enter this request multiple times, e.g. in multi-file projects,
// so in order to avoid synthesizing a property many times, first perform
// a lookup and return if it already exists.
if (auto existingProp = lookupDistributedActorProperty(classDecl, C.Id_id)) {
return existingProp;
}
return addImplicitDistributedActorIDProperty(classDecl);
}