mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[sourcekitd] Report entities that are implicitly objc as objc in the index request responses for compatibility
Members of an @objcMembers context previous had implicit @objc attributes, but now don't (possibly because of the request evaluator changes?). This updates the output of sourcekitd's 'index' request to act as if they still had implicit @objc attributes on them for compatibility. Resolves rdar://problem/48140265
This commit is contained in:
@@ -60,6 +60,24 @@ using swift::index::SymbolRoleSet;
|
||||
#define REFACTORING(KIND, NAME, ID) static UIdent Kind##Refactoring##KIND("source.refactoring.kind."#ID);
|
||||
#include "swift/IDE/RefactoringKinds.def"
|
||||
|
||||
static UIdent Attr_IBAction("source.decl.attribute.ibaction");
|
||||
static UIdent Attr_IBOutlet("source.decl.attribute.iboutlet");
|
||||
static UIdent Attr_IBDesignable("source.decl.attribute.ibdesignable");
|
||||
static UIdent Attr_IBInspectable("source.decl.attribute.ibinspectable");
|
||||
static UIdent Attr_GKInspectable("source.decl.attribute.gkinspectable");
|
||||
static UIdent Attr_Objc("source.decl.attribute.objc");
|
||||
static UIdent Attr_ObjcNamed("source.decl.attribute.objc.name");
|
||||
static UIdent Attr_Private("source.decl.attribute.private");
|
||||
static UIdent Attr_FilePrivate("source.decl.attribute.fileprivate");
|
||||
static UIdent Attr_Internal("source.decl.attribute.internal");
|
||||
static UIdent Attr_Public("source.decl.attribute.public");
|
||||
static UIdent Attr_Open("source.decl.attribute.open");
|
||||
static UIdent Attr_Setter_Private("source.decl.attribute.setter_access.private");
|
||||
static UIdent Attr_Setter_FilePrivate("source.decl.attribute.setter_access.fileprivate");
|
||||
static UIdent Attr_Setter_Internal("source.decl.attribute.setter_access.internal");
|
||||
static UIdent Attr_Setter_Public("source.decl.attribute.setter_access.public");
|
||||
static UIdent Attr_Setter_Open("source.decl.attribute.setter_access.open");
|
||||
|
||||
std::unique_ptr<LangSupport>
|
||||
SourceKit::createSwiftLangSupport(SourceKit::Context &SKCtx) {
|
||||
return std::unique_ptr<LangSupport>(new SwiftLangSupport(SKCtx));
|
||||
@@ -264,6 +282,10 @@ SourceKit::UIdent SwiftLangSupport::getUIDForModuleRef() {
|
||||
return KindRefModule;
|
||||
}
|
||||
|
||||
SourceKit::UIdent SwiftLangSupport::getUIDForObjCAttr() {
|
||||
return Attr_Objc;
|
||||
}
|
||||
|
||||
UIdent SwiftLangSupport::getUIDForRefactoringKind(ide::RefactoringKind Kind){
|
||||
switch(Kind) {
|
||||
case ide::RefactoringKind::None: llvm_unreachable("cannot end up here.");
|
||||
@@ -639,28 +661,21 @@ Optional<UIdent> SwiftLangSupport::getUIDForDeclAttribute(const swift::DeclAttri
|
||||
// Check special-case names first.
|
||||
switch (Attr->getKind()) {
|
||||
case DAK_IBAction: {
|
||||
static UIdent Attr_IBAction("source.decl.attribute.ibaction");
|
||||
return Attr_IBAction;
|
||||
}
|
||||
case DAK_IBOutlet: {
|
||||
static UIdent Attr_IBOutlet("source.decl.attribute.iboutlet");
|
||||
return Attr_IBOutlet;
|
||||
}
|
||||
case DAK_IBDesignable: {
|
||||
static UIdent Attr_IBDesignable("source.decl.attribute.ibdesignable");
|
||||
return Attr_IBDesignable;
|
||||
}
|
||||
case DAK_IBInspectable: {
|
||||
static UIdent Attr_IBInspectable("source.decl.attribute.ibinspectable");
|
||||
return Attr_IBInspectable;
|
||||
}
|
||||
case DAK_GKInspectable: {
|
||||
static UIdent Attr_GKInspectable("source.decl.attribute.gkinspectable");
|
||||
return Attr_GKInspectable;
|
||||
}
|
||||
case DAK_ObjC: {
|
||||
static UIdent Attr_Objc("source.decl.attribute.objc");
|
||||
static UIdent Attr_ObjcNamed("source.decl.attribute.objc.name");
|
||||
if (cast<ObjCAttr>(Attr)->hasName()) {
|
||||
return Attr_ObjcNamed;
|
||||
} else {
|
||||
@@ -668,12 +683,6 @@ Optional<UIdent> SwiftLangSupport::getUIDForDeclAttribute(const swift::DeclAttri
|
||||
}
|
||||
}
|
||||
case DAK_AccessControl: {
|
||||
static UIdent Attr_Private("source.decl.attribute.private");
|
||||
static UIdent Attr_FilePrivate("source.decl.attribute.fileprivate");
|
||||
static UIdent Attr_Internal("source.decl.attribute.internal");
|
||||
static UIdent Attr_Public("source.decl.attribute.public");
|
||||
static UIdent Attr_Open("source.decl.attribute.open");
|
||||
|
||||
switch (cast<AbstractAccessControlAttr>(Attr)->getAccess()) {
|
||||
case AccessLevel::Private:
|
||||
return Attr_Private;
|
||||
@@ -688,23 +697,17 @@ Optional<UIdent> SwiftLangSupport::getUIDForDeclAttribute(const swift::DeclAttri
|
||||
}
|
||||
}
|
||||
case DAK_SetterAccess: {
|
||||
static UIdent Attr_Private("source.decl.attribute.setter_access.private");
|
||||
static UIdent Attr_FilePrivate("source.decl.attribute.setter_access.fileprivate");
|
||||
static UIdent Attr_Internal("source.decl.attribute.setter_access.internal");
|
||||
static UIdent Attr_Public("source.decl.attribute.setter_access.public");
|
||||
static UIdent Attr_Open("source.decl.attribute.setter_access.open");
|
||||
|
||||
switch (cast<AbstractAccessControlAttr>(Attr)->getAccess()) {
|
||||
case AccessLevel::Private:
|
||||
return Attr_Private;
|
||||
return Attr_Setter_Private;
|
||||
case AccessLevel::FilePrivate:
|
||||
return Attr_FilePrivate;
|
||||
return Attr_Setter_FilePrivate;
|
||||
case AccessLevel::Internal:
|
||||
return Attr_Internal;
|
||||
return Attr_Setter_Internal;
|
||||
case AccessLevel::Public:
|
||||
return Attr_Public;
|
||||
return Attr_Setter_Public;
|
||||
case AccessLevel::Open:
|
||||
return Attr_Open;
|
||||
return Attr_Setter_Open;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user