File tree Expand file tree Collapse file tree 2 files changed +42
-2
lines changed
test/SourceKit/DocumentStructure
tools/SourceKit/lib/SwiftLang Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %sourcekitd-test -req=structure %s -- %s | %FileCheck %s
2
+
3
+ class C {
4
+ @IBAction init ( foo: Void ) { }
5
+ @IBAction init ( bar: ( ) ) { }
6
+ @IBAction init ( baz: Int ) { }
7
+ @IBAction func methodName( foo: ( ) ) { }
8
+ @IBAction func methodName( bar: Void ) { }
9
+ @IBAction func methodName( baz: Int ) { }
10
+ @IBAction deinit { }
11
+ }
12
+
13
+ // CHECK: {
14
+ // CHECK: key.name: "init(foo:)",
15
+ // CHECK-NOT: key.selector_name
16
+ // CHECK: }
17
+ // CHECK: {
18
+ // CHECK: key.name: "init(bar:)",
19
+ // CHECK-NOT: key.selector_name
20
+ // CHECK: }
21
+ // CHECK: {
22
+ // CHECK: key.name: "init(baz:)",
23
+ // CHECK-NOT: key.selector_name
24
+ // CHECK: }
25
+ // CHECK: {
26
+ // CHECK: key.name: "methodName(foo:)",
27
+ // CHECK: key.selector_name: "methodNameWithFoo:"
28
+ // CHECK: }
29
+ // CHECK: {
30
+ // CHECK: key.name: "methodName(bar:)",
31
+ // CHECK: key.selector_name: "methodNameWithBar:"
32
+ // CHECK: }
33
+ // CHECK: {
34
+ // CHECK: key.name: "methodName(baz:)",
35
+ // CHECK: key.selector_name: "methodNameWithBaz:"
36
+ // CHECK: }
37
+ // CHECK: {
38
+ // CHECK: key.name: "deinit",
39
+ // CHECK-NOT: key.selector_name
40
+ // CHECK: }
Original file line number Diff line number Diff line change @@ -1266,8 +1266,8 @@ class SwiftDocumentStructureWalker: public ide::SyntaxModelWalker {
1266
1266
}
1267
1267
1268
1268
StringRef getObjCSelectorName (const Decl *D, SmallString<64 > &Buf) {
1269
- if ( auto FuncD = dyn_cast_or_null<AbstractFunctionDecl>(D)) {
1270
- // We only vend the selector name for @IBAction methods.
1269
+ // We only vend the selector name for @IBAction methods.
1270
+ if ( auto FuncD = dyn_cast_or_null<FuncDecl>(D)) {
1271
1271
if (FuncD->getAttrs ().hasAttribute <IBActionAttr>())
1272
1272
return FuncD->getObjCSelector ().getString (Buf);
1273
1273
}
You can’t perform that action at this time.
0 commit comments