Skip to content

Commit 114ee28

Browse files
committed
AST: Add a DescriptiveDeclKind for actors.
1 parent b2e34b2 commit 114ee28

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

include/swift/AST/Decl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,12 @@ enum class DescriptiveDeclKind : uint8_t {
159159
Enum,
160160
Struct,
161161
Class,
162+
Actor,
162163
Protocol,
163164
GenericEnum,
164165
GenericStruct,
165166
GenericClass,
167+
GenericActor,
166168
GenericType,
167169
Subscript,
168170
StaticSubscript,

lib/AST/Decl.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,14 @@ DescriptiveDeclKind Decl::getDescriptiveKind() const {
180180
? DescriptiveDeclKind::GenericStruct
181181
: DescriptiveDeclKind::Struct;
182182

183-
case DeclKind::Class:
183+
case DeclKind::Class: {
184+
bool isActor = cast<ClassDecl>(this)->isActor();
184185
return cast<ClassDecl>(this)->getGenericParams()
185-
? DescriptiveDeclKind::GenericClass
186-
: DescriptiveDeclKind::Class;
186+
? (isActor ? DescriptiveDeclKind::GenericActor
187+
: DescriptiveDeclKind::GenericClass)
188+
: (isActor ? DescriptiveDeclKind::Actor
189+
: DescriptiveDeclKind::Class);
190+
}
187191

188192
case DeclKind::Var: {
189193
auto var = cast<VarDecl>(this);
@@ -317,10 +321,12 @@ StringRef Decl::getDescriptiveKindName(DescriptiveDeclKind K) {
317321
ENTRY(Enum, "enum");
318322
ENTRY(Struct, "struct");
319323
ENTRY(Class, "class");
324+
ENTRY(Actor, "actor");
320325
ENTRY(Protocol, "protocol");
321326
ENTRY(GenericEnum, "generic enum");
322327
ENTRY(GenericStruct, "generic struct");
323328
ENTRY(GenericClass, "generic class");
329+
ENTRY(GenericActor, "generic actor");
324330
ENTRY(GenericType, "generic type");
325331
ENTRY(Subscript, "subscript");
326332
ENTRY(StaticSubscript, "static subscript");

0 commit comments

Comments
 (0)