Skip to content

Commit 70360eb

Browse files
committed
[TypeCheckConcurrency] Stop exposing isAsynchronousContext as no longer useful
`ConstraintSystem` has its own method to determine this.
1 parent fc0f05f commit 70360eb

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,21 @@ namespace {
17441744
}
17451745

17461746
bool isInAsynchronousContext() const {
1747-
return isAsynchronousContext(getDeclContext());
1747+
auto *dc = getDeclContext();
1748+
1749+
if (auto func = dyn_cast<AbstractFunctionDecl>(dc)) {
1750+
return func->isAsyncContext();
1751+
}
1752+
1753+
if (auto closure = dyn_cast<AbstractClosureExpr>(dc)) {
1754+
if (auto type = closure->getType()) {
1755+
if (auto fnType = type->getAs<AnyFunctionType>()) {
1756+
return fnType->isAsync();
1757+
}
1758+
}
1759+
}
1760+
1761+
return false;
17481762
}
17491763

17501764
enum class AsyncMarkingResult {
@@ -4193,22 +4207,6 @@ bool swift::completionContextUsesConcurrencyFeatures(const DeclContext *dc) {
41934207
return contextUsesConcurrencyFeatures(dc);
41944208
}
41954209

4196-
bool swift::isAsynchronousContext(const DeclContext *dc) {
4197-
if (auto func = dyn_cast<AbstractFunctionDecl>(dc)) {
4198-
return func->isAsyncContext();
4199-
}
4200-
4201-
if (auto closure = dyn_cast<AbstractClosureExpr>(dc)) {
4202-
if (auto type = closure->getType()) {
4203-
if (auto fnType = type->getAs<AnyFunctionType>()) {
4204-
return fnType->isAsync();
4205-
}
4206-
}
4207-
}
4208-
4209-
return false;
4210-
}
4211-
42124210
AbstractFunctionDecl const *swift::isActorInitOrDeInitContext(
42134211
const DeclContext *dc,
42144212
llvm::function_ref<bool(const AbstractClosureExpr *)> isSendable) {

lib/Sema/TypeCheckConcurrency.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,6 @@ bool isDispatchQueueOperationName(StringRef name);
329329
bool checkSendableConformance(
330330
ProtocolConformance *conformance, SendableCheck check);
331331

332-
/// Check whether the given declaration context is asynchronous e.g.
333-
/// function or a closure declaration marked as `async`.
334-
bool isAsynchronousContext(const DeclContext *dc);
335-
336332
/// Check whether we are in an actor's initializer or deinitializer.
337333
/// \returns nullptr iff we are not in such a declaration. Otherwise,
338334
/// returns a pointer to the declaration.

0 commit comments

Comments
 (0)