@@ -7545,118 +7545,6 @@ bool AbstractFunctionDecl::isSendable() const {
7545
7545
return getAttrs ().hasAttribute <SendableAttr>();
7546
7546
}
7547
7547
7548
- bool AbstractFunctionDecl::isDistributedActorSystemRemoteCall (bool isVoidReturn) const {
7549
- auto &C = this ->getASTContext ();
7550
-
7551
- auto callId = isVoidReturn ? C.Id_remoteCallVoid : C.Id_remoteCall ;
7552
-
7553
- // Check the name
7554
- if (getBaseName () != callId)
7555
- return false ;
7556
-
7557
- auto params = getParameters ();
7558
- unsigned int expectedParamNum = isVoidReturn ? 4 : 5 ;
7559
-
7560
- // Check the expected argument count:
7561
- if (!params || params->size () != expectedParamNum)
7562
- return false ;
7563
-
7564
- // Check API names of the arguments
7565
- auto actorParam = params->get (0 );
7566
- auto targetParam = params->get (1 );
7567
- auto invocationParam = params->get (2 );
7568
- auto thrownTypeParam = params->get (3 );
7569
- if (actorParam->getArgumentName () != C.Id_on ||
7570
- targetParam->getArgumentName () != C.Id_target ||
7571
- invocationParam->getArgumentName () != C.Id_invocation ||
7572
- thrownTypeParam->getArgumentName () != C.Id_throwing )
7573
- return false ;
7574
-
7575
- if (!isVoidReturn) {
7576
- auto returnedTypeParam = params->get (4 );
7577
- if (returnedTypeParam->getArgumentName () != C.Id_returning )
7578
- return false ;
7579
- }
7580
-
7581
- if (!isGeneric ())
7582
- return false ;
7583
-
7584
- auto genericParams = getGenericParams ();
7585
- unsigned int expectedGenericParamNum = isVoidReturn ? 2 : 3 ;
7586
-
7587
- // We expect: Act, Err, Res?
7588
- if (genericParams->size () != expectedGenericParamNum) {
7589
- return false ;
7590
- }
7591
-
7592
- // FIXME(distributed): check the exact generic requirements
7593
-
7594
- // === check the return type
7595
- if (isVoidReturn) {
7596
- if (auto func = dyn_cast<FuncDecl>(this ))
7597
- if (!func->getResultInterfaceType ()->isVoid ())
7598
- return false ;
7599
- }
7600
-
7601
- // FIXME(distributed): check the right types of the args and generics...
7602
- // FIXME(distributed): check access level actually is ok, i.e. not private etc
7603
-
7604
- return true ;
7605
- }
7606
-
7607
- bool AbstractFunctionDecl::isDistributed () const {
7608
- return getAttrs ().hasAttribute <DistributedActorAttr>();
7609
- }
7610
-
7611
- ConstructorDecl*
7612
- NominalTypeDecl::getDistributedRemoteCallTargetInitFunction () const {
7613
- auto &C = this ->getASTContext ();
7614
-
7615
- // FIXME(distributed): implement more properly... do with caching etc
7616
- auto mutableThis = const_cast <NominalTypeDecl *>(this );
7617
- for (auto value : mutableThis->getMembers ()) {
7618
- auto ctor = dyn_cast<ConstructorDecl>(value);
7619
- if (!ctor)
7620
- continue ;
7621
-
7622
- auto params = ctor->getParameters ();
7623
- if (params->size () != 1 )
7624
- return nullptr ;
7625
-
7626
- if (params->get (0 )->getArgumentName () == C.getIdentifier (" _mangledName" ))
7627
- return ctor;
7628
-
7629
- return nullptr ;
7630
- }
7631
-
7632
- // TODO(distributed): make a Request for it?
7633
- return nullptr ;
7634
- }
7635
-
7636
- VarDecl*
7637
- NominalTypeDecl::getDistributedActorSystemProperty () const {
7638
- if (!this ->isDistributedActor ())
7639
- return nullptr ;
7640
-
7641
- auto mutableThis = const_cast <NominalTypeDecl *>(this );
7642
- return evaluateOrDefault (
7643
- getASTContext ().evaluator ,
7644
- GetDistributedActorSystemPropertyRequest{mutableThis},
7645
- nullptr );
7646
- }
7647
-
7648
- VarDecl*
7649
- NominalTypeDecl::getDistributedActorIDProperty () const {
7650
- if (!this ->isDistributedActor ())
7651
- return nullptr ;
7652
-
7653
- auto mutableThis = const_cast <NominalTypeDecl *>(this );
7654
- return evaluateOrDefault (
7655
- getASTContext ().evaluator ,
7656
- GetDistributedActorIDPropertyRequest{mutableThis},
7657
- nullptr );
7658
- }
7659
-
7660
7548
BraceStmt *AbstractFunctionDecl::getBody (bool canSynthesize) const {
7661
7549
if ((getBodyKind () == BodyKind::Synthesize ||
7662
7550
getBodyKind () == BodyKind::Unparsed) &&
0 commit comments