File tree Expand file tree Collapse file tree 5 files changed +157
-5
lines changed
test/SourceKit/DocumentStructure
tools/SourceKit/lib/SwiftLang Expand file tree Collapse file tree 5 files changed +157
-5
lines changed Original file line number Diff line number Diff line change @@ -178,3 +178,9 @@ var var_with_didset = 10 {
178
178
var thing : NSObject { get }
179
179
}
180
180
#endif
181
+
182
+ class A {
183
+ #if true
184
+ @IBAction @objc func foo( a: Int ) { }
185
+ #endif
186
+ }
Original file line number Diff line number Diff line change 1
1
{
2
2
key.offset: 0,
3
- key.length: 2787 ,
3
+ key.length: 2858 ,
4
4
key.diagnostic_stage: source.diagnostic.stage.swift.parse,
5
5
key.substructure: [
6
6
{
1689
1689
key.bodylength: 3
1690
1690
}
1691
1691
]
1692
+ },
1693
+ {
1694
+ key.kind: source.lang.swift.decl.class,
1695
+ key.accessibility: source.lang.swift.accessibility.internal,
1696
+ key.name: "A",
1697
+ key.offset: 2788,
1698
+ key.length: 69,
1699
+ key.nameoffset: 2794,
1700
+ key.namelength: 1,
1701
+ key.bodyoffset: 2797,
1702
+ key.bodylength: 59,
1703
+ key.substructure: [
1704
+ {
1705
+ key.kind: source.lang.swift.decl.function.method.instance,
1706
+ key.accessibility: source.lang.swift.accessibility.internal,
1707
+ key.name: "foo(a:)",
1708
+ key.offset: 2827,
1709
+ key.length: 19,
1710
+ key.selector_name: "fooWithA:",
1711
+ key.nameoffset: 2832,
1712
+ key.namelength: 11,
1713
+ key.bodyoffset: 2845,
1714
+ key.bodylength: 0,
1715
+ key.attributes: [
1716
+ {
1717
+ key.offset: 2821,
1718
+ key.length: 5,
1719
+ key.attribute: source.decl.attribute.objc.name
1720
+ },
1721
+ {
1722
+ key.offset: 2811,
1723
+ key.length: 9,
1724
+ key.attribute: source.decl.attribute.ibaction
1725
+ }
1726
+ ],
1727
+ key.substructure: [
1728
+ {
1729
+ key.kind: source.lang.swift.decl.var.parameter,
1730
+ key.name: "a",
1731
+ key.offset: 2836,
1732
+ key.length: 6,
1733
+ key.typename: "Int",
1734
+ key.nameoffset: 2836,
1735
+ key.namelength: 1
1736
+ }
1737
+ ]
1738
+ }
1739
+ ]
1692
1740
}
1693
1741
],
1694
1742
key.diagnostics: [
Original file line number Diff line number Diff line change 1
1
{
2
2
key.offset: 0,
3
- key.length: 2787 ,
3
+ key.length: 2858 ,
4
4
key.diagnostic_stage: source.diagnostic.stage.swift.parse,
5
5
key.substructure: [
6
6
{
1689
1689
key.bodylength: 3
1690
1690
}
1691
1691
]
1692
+ },
1693
+ {
1694
+ key.kind: source.lang.swift.decl.class,
1695
+ key.accessibility: source.lang.swift.accessibility.internal,
1696
+ key.name: "A",
1697
+ key.offset: 2788,
1698
+ key.length: 69,
1699
+ key.nameoffset: 2794,
1700
+ key.namelength: 1,
1701
+ key.bodyoffset: 2797,
1702
+ key.bodylength: 59,
1703
+ key.substructure: [
1704
+ {
1705
+ key.kind: source.lang.swift.decl.function.method.instance,
1706
+ key.accessibility: source.lang.swift.accessibility.internal,
1707
+ key.name: "foo(a:)",
1708
+ key.offset: 2827,
1709
+ key.length: 19,
1710
+ key.selector_name: "fooWithA:",
1711
+ key.nameoffset: 2832,
1712
+ key.namelength: 11,
1713
+ key.bodyoffset: 2845,
1714
+ key.bodylength: 0,
1715
+ key.attributes: [
1716
+ {
1717
+ key.offset: 2821,
1718
+ key.length: 5,
1719
+ key.attribute: source.decl.attribute.objc.name
1720
+ },
1721
+ {
1722
+ key.offset: 2811,
1723
+ key.length: 9,
1724
+ key.attribute: source.decl.attribute.ibaction
1725
+ }
1726
+ ],
1727
+ key.substructure: [
1728
+ {
1729
+ key.kind: source.lang.swift.decl.var.parameter,
1730
+ key.name: "a",
1731
+ key.offset: 2836,
1732
+ key.length: 6,
1733
+ key.typename: "Int",
1734
+ key.nameoffset: 2836,
1735
+ key.namelength: 1
1736
+ }
1737
+ ]
1738
+ }
1739
+ ]
1692
1740
}
1693
1741
],
1694
1742
key.diagnostics: [
Original file line number Diff line number Diff line change 1
1
{
2
2
key.offset: 0,
3
- key.length: 2787 ,
3
+ key.length: 2858 ,
4
4
key.diagnostic_stage: source.diagnostic.stage.swift.parse,
5
5
key.substructure: [
6
6
{
1689
1689
key.bodylength: 3
1690
1690
}
1691
1691
]
1692
+ },
1693
+ {
1694
+ key.kind: source.lang.swift.decl.class,
1695
+ key.accessibility: source.lang.swift.accessibility.internal,
1696
+ key.name: "A",
1697
+ key.offset: 2788,
1698
+ key.length: 69,
1699
+ key.nameoffset: 2794,
1700
+ key.namelength: 1,
1701
+ key.bodyoffset: 2797,
1702
+ key.bodylength: 59,
1703
+ key.substructure: [
1704
+ {
1705
+ key.kind: source.lang.swift.decl.function.method.instance,
1706
+ key.accessibility: source.lang.swift.accessibility.internal,
1707
+ key.name: "foo(a:)",
1708
+ key.offset: 2827,
1709
+ key.length: 19,
1710
+ key.selector_name: "fooWithA:",
1711
+ key.nameoffset: 2832,
1712
+ key.namelength: 11,
1713
+ key.bodyoffset: 2845,
1714
+ key.bodylength: 0,
1715
+ key.attributes: [
1716
+ {
1717
+ key.offset: 2821,
1718
+ key.length: 5,
1719
+ key.attribute: source.decl.attribute.objc.name
1720
+ },
1721
+ {
1722
+ key.offset: 2811,
1723
+ key.length: 9,
1724
+ key.attribute: source.decl.attribute.ibaction
1725
+ }
1726
+ ],
1727
+ key.substructure: [
1728
+ {
1729
+ key.kind: source.lang.swift.decl.var.parameter,
1730
+ key.name: "a",
1731
+ key.offset: 2836,
1732
+ key.length: 6,
1733
+ key.typename: "Int",
1734
+ key.nameoffset: 2836,
1735
+ key.namelength: 1
1736
+ }
1737
+ ]
1738
+ }
1739
+ ]
1692
1740
}
1693
1741
],
1694
1742
key.diagnostics: [
Original file line number Diff line number Diff line change @@ -1363,8 +1363,10 @@ class SwiftDocumentStructureWalker: public ide::SyntaxModelWalker {
1363
1363
// We only vend the selector name for @IBAction and @IBSegueAction methods.
1364
1364
if (auto FuncD = dyn_cast_or_null<FuncDecl>(D)) {
1365
1365
if (FuncD->getAttrs ().hasAttribute <IBActionAttr>() ||
1366
- FuncD->getAttrs ().hasAttribute <IBSegueActionAttr>())
1367
- return FuncD->getObjCSelector ().getString (Buf);
1366
+ FuncD->getAttrs ().hasAttribute <IBSegueActionAttr>()) {
1367
+ return FuncD->getObjCSelector (DeclName (), /* skipIsObjCResolution*/ true )
1368
+ .getString (Buf);
1369
+ }
1368
1370
}
1369
1371
return StringRef ();
1370
1372
}
You can’t perform that action at this time.
0 commit comments