Skip to content

Commit a1ae362

Browse files
committed
[Distributed] remove duplicated code
1 parent fa1b4b2 commit a1ae362

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/Sema/DerivedConformanceDistributedActor.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ createStoredProperty(ClassDecl *classDecl, ASTContext &ctx,
6060

6161
static ValueDecl *deriveDistributedActor_id(DerivedConformance &derived) {
6262
assert(derived.Nominal->isDistributedActor());
63-
auto decl = dyn_cast<ClassDecl>(derived.Nominal);
6463
auto &C = derived.Context;
6564

6665
// ```
@@ -71,9 +70,8 @@ static ValueDecl *deriveDistributedActor_id(DerivedConformance &derived) {
7170

7271
VarDecl *propDecl;
7372
PatternBindingDecl *pbDecl;
74-
std::tie(propDecl, pbDecl) = createStoredProperty(
75-
decl, C,
76-
VarDecl::Introducer::Let, C.Id_id,
73+
std::tie(propDecl, pbDecl) = derived.declareDerivedProperty(
74+
C.Id_id,
7775
propertyType, propertyType,
7876
/*isStatic=*/false, /*isFinal=*/true);
7977

@@ -88,7 +86,6 @@ static ValueDecl *deriveDistributedActor_id(DerivedConformance &derived) {
8886
static ValueDecl *deriveDistributedActor_actorTransport(
8987
DerivedConformance &derived) {
9088
assert(derived.Nominal->isDistributedActor());
91-
auto decl = dyn_cast<ClassDecl>(derived.Nominal);
9289
auto &C = derived.Context;
9390

9491
// ```
@@ -100,9 +97,8 @@ static ValueDecl *deriveDistributedActor_actorTransport(
10097

10198
VarDecl *propDecl;
10299
PatternBindingDecl *pbDecl;
103-
std::tie(propDecl, pbDecl) = createStoredProperty(
104-
decl, C,
105-
VarDecl::Introducer::Let, C.Id_actorTransport,
100+
std::tie(propDecl, pbDecl) = derived.declareDerivedProperty(
101+
C.Id_actorTransport,
106102
propertyType, propertyType,
107103
/*isStatic=*/false, /*isFinal=*/true);
108104

0 commit comments

Comments
 (0)