@@ -60,6 +60,24 @@ using swift::index::SymbolRoleSet;
60
60
#define REFACTORING (KIND, NAME, ID ) static UIdent Kind##Refactoring##KIND(" source.refactoring.kind." #ID);
61
61
#include " swift/IDE/RefactoringKinds.def"
62
62
63
+ static UIdent Attr_IBAction (" source.decl.attribute.ibaction" );
64
+ static UIdent Attr_IBOutlet (" source.decl.attribute.iboutlet" );
65
+ static UIdent Attr_IBDesignable (" source.decl.attribute.ibdesignable" );
66
+ static UIdent Attr_IBInspectable (" source.decl.attribute.ibinspectable" );
67
+ static UIdent Attr_GKInspectable (" source.decl.attribute.gkinspectable" );
68
+ static UIdent Attr_Objc (" source.decl.attribute.objc" );
69
+ static UIdent Attr_ObjcNamed (" source.decl.attribute.objc.name" );
70
+ static UIdent Attr_Private (" source.decl.attribute.private" );
71
+ static UIdent Attr_FilePrivate (" source.decl.attribute.fileprivate" );
72
+ static UIdent Attr_Internal (" source.decl.attribute.internal" );
73
+ static UIdent Attr_Public (" source.decl.attribute.public" );
74
+ static UIdent Attr_Open (" source.decl.attribute.open" );
75
+ static UIdent Attr_Setter_Private (" source.decl.attribute.setter_access.private" );
76
+ static UIdent Attr_Setter_FilePrivate (" source.decl.attribute.setter_access.fileprivate" );
77
+ static UIdent Attr_Setter_Internal (" source.decl.attribute.setter_access.internal" );
78
+ static UIdent Attr_Setter_Public (" source.decl.attribute.setter_access.public" );
79
+ static UIdent Attr_Setter_Open (" source.decl.attribute.setter_access.open" );
80
+
63
81
std::unique_ptr<LangSupport>
64
82
SourceKit::createSwiftLangSupport (SourceKit::Context &SKCtx) {
65
83
return std::unique_ptr<LangSupport>(new SwiftLangSupport (SKCtx));
@@ -264,6 +282,10 @@ SourceKit::UIdent SwiftLangSupport::getUIDForModuleRef() {
264
282
return KindRefModule;
265
283
}
266
284
285
+ SourceKit::UIdent SwiftLangSupport::getUIDForObjCAttr () {
286
+ return Attr_Objc;
287
+ }
288
+
267
289
UIdent SwiftLangSupport::getUIDForRefactoringKind (ide::RefactoringKind Kind){
268
290
switch (Kind) {
269
291
case ide::RefactoringKind::None: llvm_unreachable (" cannot end up here." );
@@ -639,41 +661,28 @@ Optional<UIdent> SwiftLangSupport::getUIDForDeclAttribute(const swift::DeclAttri
639
661
// Check special-case names first.
640
662
switch (Attr->getKind ()) {
641
663
case DAK_IBAction: {
642
- static UIdent Attr_IBAction (" source.decl.attribute.ibaction" );
643
664
return Attr_IBAction;
644
665
}
645
666
case DAK_IBOutlet: {
646
- static UIdent Attr_IBOutlet (" source.decl.attribute.iboutlet" );
647
667
return Attr_IBOutlet;
648
668
}
649
669
case DAK_IBDesignable: {
650
- static UIdent Attr_IBDesignable (" source.decl.attribute.ibdesignable" );
651
670
return Attr_IBDesignable;
652
671
}
653
672
case DAK_IBInspectable: {
654
- static UIdent Attr_IBInspectable (" source.decl.attribute.ibinspectable" );
655
673
return Attr_IBInspectable;
656
674
}
657
675
case DAK_GKInspectable: {
658
- static UIdent Attr_GKInspectable (" source.decl.attribute.gkinspectable" );
659
676
return Attr_GKInspectable;
660
677
}
661
678
case DAK_ObjC: {
662
- static UIdent Attr_Objc (" source.decl.attribute.objc" );
663
- static UIdent Attr_ObjcNamed (" source.decl.attribute.objc.name" );
664
679
if (cast<ObjCAttr>(Attr)->hasName ()) {
665
680
return Attr_ObjcNamed;
666
681
} else {
667
682
return Attr_Objc;
668
683
}
669
684
}
670
685
case DAK_AccessControl: {
671
- static UIdent Attr_Private (" source.decl.attribute.private" );
672
- static UIdent Attr_FilePrivate (" source.decl.attribute.fileprivate" );
673
- static UIdent Attr_Internal (" source.decl.attribute.internal" );
674
- static UIdent Attr_Public (" source.decl.attribute.public" );
675
- static UIdent Attr_Open (" source.decl.attribute.open" );
676
-
677
686
switch (cast<AbstractAccessControlAttr>(Attr)->getAccess ()) {
678
687
case AccessLevel::Private:
679
688
return Attr_Private;
@@ -688,23 +697,17 @@ Optional<UIdent> SwiftLangSupport::getUIDForDeclAttribute(const swift::DeclAttri
688
697
}
689
698
}
690
699
case DAK_SetterAccess: {
691
- static UIdent Attr_Private (" source.decl.attribute.setter_access.private" );
692
- static UIdent Attr_FilePrivate (" source.decl.attribute.setter_access.fileprivate" );
693
- static UIdent Attr_Internal (" source.decl.attribute.setter_access.internal" );
694
- static UIdent Attr_Public (" source.decl.attribute.setter_access.public" );
695
- static UIdent Attr_Open (" source.decl.attribute.setter_access.open" );
696
-
697
700
switch (cast<AbstractAccessControlAttr>(Attr)->getAccess ()) {
698
701
case AccessLevel::Private:
699
- return Attr_Private ;
702
+ return Attr_Setter_Private ;
700
703
case AccessLevel::FilePrivate:
701
- return Attr_FilePrivate ;
704
+ return Attr_Setter_FilePrivate ;
702
705
case AccessLevel::Internal:
703
- return Attr_Internal ;
706
+ return Attr_Setter_Internal ;
704
707
case AccessLevel::Public:
705
- return Attr_Public ;
708
+ return Attr_Setter_Public ;
706
709
case AccessLevel::Open:
707
- return Attr_Open ;
710
+ return Attr_Setter_Open ;
708
711
}
709
712
}
710
713
0 commit comments