Skip to content

Add feature for _implicitSelfCapture attribute. #37334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/swift/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ LANGUAGE_FEATURE(BuiltinExecutor, 0, "Builtin.Executor type", true)
LANGUAGE_FEATURE(BuiltinContinuation, 0, "Continuation builtins", true)
LANGUAGE_FEATURE(BuiltinTaskGroup, 0, "TaskGroup builtins", true)
LANGUAGE_FEATURE(InheritActorContext, 0, "@_inheritActorContext attribute", true)
LANGUAGE_FEATURE(ImplicitSelfCapture, 0, "@_implicitSelfCapture attribute", true)
LANGUAGE_FEATURE(BuiltinBuildExecutor, 0, "Executor-building builtins", true)

#undef LANGUAGE_FEATURE
11 changes: 11 additions & 0 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2776,6 +2776,17 @@ static bool usesFeatureInheritActorContext(Decl *decl) {
return false;
}

static bool usesFeatureImplicitSelfCapture(Decl *decl) {
if (auto func = dyn_cast<AbstractFunctionDecl>(decl)) {
for (auto param : *func->getParameters()) {
if (param->getAttrs().hasAttribute<ImplicitSelfCaptureAttr>())
return true;
}
}

return false;
}

/// Determine the set of "new" features used on a given declaration.
///
/// Note: right now, all features we check for are "new". At some point, we'll
Expand Down