Skip to content

Commit d2dfbb4

Browse files
committed
[AST][Sema] Add ValueDecl::hasCurriedSelf
This is a minimal cherry-pick of swiftlang#25170.
1 parent e65dfc8 commit d2dfbb4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

include/swift/AST/Decl.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,11 @@ class ValueDecl : public Decl {
26972697
/// True if this is a C function that was imported as a member of a type in
26982698
/// Swift.
26992699
bool isImportAsMember() const;
2700-
2700+
2701+
/// Returns true if the declaration's interface type is a function type with a
2702+
/// curried self parameter.
2703+
bool hasCurriedSelf() const;
2704+
27012705
/// Get the decl for this value's opaque result type, if it has one.
27022706
OpaqueTypeDecl *getOpaqueResultTypeDecl() const;
27032707

@@ -7168,6 +7172,14 @@ inline bool ValueDecl::isImportAsMember() const {
71687172
return false;
71697173
}
71707174

7175+
inline bool ValueDecl::hasCurriedSelf() const {
7176+
if (auto *afd = dyn_cast<AbstractFunctionDecl>(this))
7177+
return afd->hasImplicitSelfDecl();
7178+
if (isa<EnumElementDecl>(this))
7179+
return true;
7180+
return false;
7181+
}
7182+
71717183
inline bool Decl::isPotentiallyOverridable() const {
71727184
if (isa<VarDecl>(this) ||
71737185
isa<SubscriptDecl>(this) ||

0 commit comments

Comments
 (0)