Skip to content

Commit 3c76419

Browse files
committed
[Distributed] Remove AST default init synthesisi replaced by ImplicitConstructorKind::DefaultDistributedActor
1 parent ad346ae commit 3c76419

File tree

1 file changed

+0
-83
lines changed

1 file changed

+0
-83
lines changed

lib/Sema/CodeSynthesisDistributedActor.cpp

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -92,89 +92,6 @@ static void addFactoryResolveFunction(ClassDecl *decl) {
9292
decl->addMember(factoryDecl);
9393
}
9494

95-
/******************************************************************************/
96-
/***************************** DEFAULT INITIALIZER ****************************/
97-
/******************************************************************************/
98-
99-
/// Synthesizes an empty body of the `init(transport:)` initializer as:
100-
///
101-
/// ```
102-
/// init(transport: ActorTransport) {
103-
/// <filled in by SILGenDistributed>
104-
/// }
105-
/// ```
106-
///
107-
/// \param initDecl The function decl whose body to synthesize.
108-
static std::pair<BraceStmt *, bool>
109-
createBody_DistributedActor_init_default(AbstractFunctionDecl *initDecl, void *) {
110-
auto *funcDC = cast<DeclContext>(initDecl);
111-
ASTContext &C = funcDC->getASTContext();
112-
113-
// We will treat this constructor just as any other local init in SILGen
114-
// and inject code that performs the id and transport initialization.
115-
// Here in Sema though it has to be
116-
auto *body = BraceStmt::create(
117-
C, SourceLoc(),
118-
{new (C) ReturnStmt(SourceLoc(), nullptr, /*Implicit=*/true)},
119-
SourceLoc(), /*implicit=*/true);
120-
121-
// Ignore the empty body in type checking;
122-
// We synthesize the implementation in SILGenDistributed
123-
return { body, /*isTypeChecked=*/true };
124-
}
125-
126-
/// Synthesizes the
127-
///
128-
/// ```
129-
/// init(transport: ActorTransport)
130-
/// ```
131-
///
132-
/// local initializer.
133-
static ConstructorDecl *
134-
createDistributedActor_init_default(ClassDecl *classDecl,
135-
ASTContext &ctx) {
136-
auto &C = ctx;
137-
auto conformanceDC = classDecl;
138-
139-
// Expected type: (Self) -> (ActorTransport) -> (Self)
140-
//
141-
// Params: (transport: ActorTransport)
142-
auto transportType = C.getActorTransportDecl()->getDeclaredInterfaceType();
143-
auto *transportParamDecl = new (C) ParamDecl(
144-
SourceLoc(), SourceLoc(), C.Id_transport,
145-
SourceLoc(), C.Id_transport, conformanceDC);
146-
transportParamDecl->setImplicit();
147-
transportParamDecl->setSpecifier(ParamSpecifier::Default);
148-
transportParamDecl->setInterfaceType(transportType);
149-
150-
auto *paramList = ParameterList::createWithoutLoc(transportParamDecl);
151-
152-
// Func name: init(transport:)
153-
DeclName name(C, DeclBaseName::createConstructor(), paramList);
154-
155-
auto *initDecl =
156-
new (C) ConstructorDecl(name, SourceLoc(),
157-
/*Failable=*/false, SourceLoc(),
158-
/*Async=*/false, SourceLoc(),
159-
/*Throws=*/false, SourceLoc(),
160-
paramList,
161-
/*GenericParams=*/nullptr, conformanceDC);
162-
initDecl->setImplicit();
163-
initDecl->setSynthesized();
164-
initDecl->setBodySynthesizer(&createBody_DistributedActor_init_default);
165-
166-
auto *nonIsoAttr = new (C) NonisolatedAttr(/*IsImplicit*/true);
167-
initDecl->getAttrs().add(nonIsoAttr);
168-
169-
initDecl->copyFormalAccessFrom(classDecl, /*sourceIsParentContext=*/true);
170-
171-
// Clone any @available attributes from the actor definition.
172-
for (auto attr: classDecl->getAttrs().getAttributes<AvailableAttr>())
173-
initDecl->getAttrs().add(attr->clone(C, /*implicit*/true));
174-
175-
return initDecl;
176-
}
177-
17895
/******************************************************************************/
17996
/******************************** DEINIT **************************************/
18097
/******************************************************************************/

0 commit comments

Comments
 (0)