Skip to content

Commit e20e420

Browse files
committed
[Index] Add an async symbol property for async functions
Resolves rdar://83780222
1 parent 9a5bb49 commit e20e420

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

lib/Index/IndexSymbol.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ SymbolInfo index::getSymbolInfoForDecl(const Decl *D) {
249249
info.Properties |= SymbolProperty::Local;
250250
}
251251

252+
if (auto *FD = dyn_cast<AbstractFunctionDecl>(D)) {
253+
if (FD->hasAsync())
254+
info.Properties |= SymbolProperty::SwiftAsync;
255+
}
256+
252257
return info;
253258
}
254259

test/Index/async.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// REQUIRES: concurrency
2+
3+
// RUN: %target-swift-ide-test -print-indexed-symbols -source-filename %s | %FileCheck %s
4+
5+
func globalAsyncFunc() async {}
6+
// CHECK: [[@LINE-1]]:6 | function(swift_async)/Swift | globalAsyncFunc() | {{.*}} | Def | rel: 0
7+
8+
struct MyStruct {
9+
func asyncMethod() async {}
10+
// CHECK: [[@LINE-1]]:8 | instance-method(swift_async)/Swift | asyncMethod() |
11+
}
12+
13+
class XCTestCase {}
14+
class MyTestCase : XCTestCase {
15+
func testSomeAsync() async {}
16+
// CHECK: [[@LINE-1]]:8 | instance-method(test,swift_async)/Swift | testSomeAsync() |
17+
}

0 commit comments

Comments
 (0)