@@ -60,6 +60,24 @@ using swift::index::SymbolRoleSet;
6060#define REFACTORING (KIND, NAME, ID ) static UIdent Kind##Refactoring##KIND(" source.refactoring.kind." #ID);
6161#include " swift/IDE/RefactoringKinds.def"
6262
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+
6381std::unique_ptr<LangSupport>
6482SourceKit::createSwiftLangSupport (SourceKit::Context &SKCtx) {
6583 return std::unique_ptr<LangSupport>(new SwiftLangSupport (SKCtx));
@@ -264,6 +282,10 @@ SourceKit::UIdent SwiftLangSupport::getUIDForModuleRef() {
264282 return KindRefModule;
265283}
266284
285+ SourceKit::UIdent SwiftLangSupport::getUIDForObjCAttr () {
286+ return Attr_Objc;
287+ }
288+
267289UIdent SwiftLangSupport::getUIDForRefactoringKind (ide::RefactoringKind Kind){
268290 switch (Kind) {
269291 case ide::RefactoringKind::None: llvm_unreachable (" cannot end up here." );
@@ -639,41 +661,28 @@ Optional<UIdent> SwiftLangSupport::getUIDForDeclAttribute(const swift::DeclAttri
639661 // Check special-case names first.
640662 switch (Attr->getKind ()) {
641663 case DAK_IBAction: {
642- static UIdent Attr_IBAction (" source.decl.attribute.ibaction" );
643664 return Attr_IBAction;
644665 }
645666 case DAK_IBOutlet: {
646- static UIdent Attr_IBOutlet (" source.decl.attribute.iboutlet" );
647667 return Attr_IBOutlet;
648668 }
649669 case DAK_IBDesignable: {
650- static UIdent Attr_IBDesignable (" source.decl.attribute.ibdesignable" );
651670 return Attr_IBDesignable;
652671 }
653672 case DAK_IBInspectable: {
654- static UIdent Attr_IBInspectable (" source.decl.attribute.ibinspectable" );
655673 return Attr_IBInspectable;
656674 }
657675 case DAK_GKInspectable: {
658- static UIdent Attr_GKInspectable (" source.decl.attribute.gkinspectable" );
659676 return Attr_GKInspectable;
660677 }
661678 case DAK_ObjC: {
662- static UIdent Attr_Objc (" source.decl.attribute.objc" );
663- static UIdent Attr_ObjcNamed (" source.decl.attribute.objc.name" );
664679 if (cast<ObjCAttr>(Attr)->hasName ()) {
665680 return Attr_ObjcNamed;
666681 } else {
667682 return Attr_Objc;
668683 }
669684 }
670685 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-
677686 switch (cast<AbstractAccessControlAttr>(Attr)->getAccess ()) {
678687 case AccessLevel::Private:
679688 return Attr_Private;
@@ -688,23 +697,17 @@ Optional<UIdent> SwiftLangSupport::getUIDForDeclAttribute(const swift::DeclAttri
688697 }
689698 }
690699 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-
697700 switch (cast<AbstractAccessControlAttr>(Attr)->getAccess ()) {
698701 case AccessLevel::Private:
699- return Attr_Private ;
702+ return Attr_Setter_Private ;
700703 case AccessLevel::FilePrivate:
701- return Attr_FilePrivate ;
704+ return Attr_Setter_FilePrivate ;
702705 case AccessLevel::Internal:
703- return Attr_Internal ;
706+ return Attr_Setter_Internal ;
704707 case AccessLevel::Public:
705- return Attr_Public ;
708+ return Attr_Setter_Public ;
706709 case AccessLevel::Open:
707- return Attr_Open ;
710+ return Attr_Setter_Open ;
708711 }
709712 }
710713
0 commit comments