mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Switch ValueDecl::getObjCSelector() and friends over to ObjCSelector.
Formatting names into strings repeatedly, and using those for semantic analysis, is generally considered poor form. Additionally, use the camelCase utilities to perform the string manipulation we need, and cache results on the ObjCAttr so we don't repeatedly do string manipulation. Swift SVN r16334
This commit is contained in:
@@ -151,7 +151,8 @@ getDynamicResultSignature(ValueDecl *decl,
|
||||
Type type;
|
||||
if (auto func = dyn_cast<FuncDecl>(decl)) {
|
||||
// Handle functions.
|
||||
selector = func->getObjCSelector(buffer);
|
||||
// FIXME: Use ObjCSelector here!
|
||||
selector = func->getObjCSelector().getString(buffer);
|
||||
type = decl->getType()->castTo<AnyFunctionType>()->getResult();
|
||||
|
||||
// Append a '+' for static methods, '-' for instance methods. This
|
||||
@@ -165,11 +166,11 @@ getDynamicResultSignature(ValueDecl *decl,
|
||||
selector = buffer.str();
|
||||
} else if (auto asd = dyn_cast<AbstractStorageDecl>(decl)) {
|
||||
// Handle properties and subscripts. Only the getter matters.
|
||||
selector = asd->getObjCGetterSelector(buffer);
|
||||
selector = asd->getObjCGetterSelector().getString(buffer);
|
||||
type = asd->getType();
|
||||
} else if (auto ctor = dyn_cast<ConstructorDecl>(decl)) {
|
||||
// Handle constructors.
|
||||
selector = ctor->getObjCSelector(buffer);
|
||||
selector = ctor->getObjCSelector().getString(buffer);
|
||||
type = decl->getType()->castTo<AnyFunctionType>()->getResult();
|
||||
} else {
|
||||
llvm_unreachable("Dynamic lookup found a non-[objc] result");
|
||||
|
||||
Reference in New Issue
Block a user