mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[ConstraintSystem] Inline static method calls into the closures
This commit is contained in:
@@ -934,14 +934,14 @@ getPropertyWrapperInformationFromOverload(
|
||||
llvm::function_ref<Optional<std::pair<VarDecl *, Type>>(VarDecl *)>
|
||||
getInformation) {
|
||||
if (auto *decl =
|
||||
dyn_cast_or_null<VarDecl>(resolvedOverload.choice.getDeclOrNull())) {
|
||||
dyn_cast_or_null<VarDecl>(resolvedOverload.choice.getDeclOrNull())) {
|
||||
if (auto declInformation = getInformation(decl)) {
|
||||
Type type;
|
||||
VarDecl *memberDecl;
|
||||
std::tie(memberDecl, type) = *declInformation;
|
||||
if (Type baseType = resolvedOverload.choice.getBaseType()) {
|
||||
type = baseType->getTypeOfMember(DC->getParentModule(), memberDecl,
|
||||
type);
|
||||
type =
|
||||
baseType->getTypeOfMember(DC->getParentModule(), memberDecl, type);
|
||||
}
|
||||
return std::make_pair(decl, type);
|
||||
}
|
||||
@@ -949,57 +949,48 @@ getPropertyWrapperInformationFromOverload(
|
||||
return None;
|
||||
}
|
||||
|
||||
static Optional<std::pair<VarDecl *, Type>>
|
||||
getStorageWrapperInformationFromDecl(VarDecl *decl) {
|
||||
if (!decl->hasAttachedPropertyWrapper())
|
||||
return None;
|
||||
|
||||
auto storageWrapper = decl->getPropertyWrapperStorageWrapper();
|
||||
if (!storageWrapper)
|
||||
return None;
|
||||
|
||||
return std::make_pair(storageWrapper, storageWrapper->getInterfaceType());
|
||||
}
|
||||
|
||||
Optional<std::pair<VarDecl *, Type>>
|
||||
ConstraintSystem::getStorageWrapperInformation(
|
||||
SelectedOverload resolvedOverload) {
|
||||
return getPropertyWrapperInformationFromOverload(
|
||||
resolvedOverload, DC,
|
||||
[](VarDecl *decl) { return getStorageWrapperInformationFromDecl(decl); });
|
||||
}
|
||||
[](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
|
||||
if (!decl->hasAttachedPropertyWrapper())
|
||||
return None;
|
||||
|
||||
static Optional<std::pair<VarDecl *, Type>>
|
||||
getPropertyWrapperInformationFromDecl(VarDecl *decl) {
|
||||
if (!decl->hasAttachedPropertyWrapper())
|
||||
return None;
|
||||
auto storageWrapper = decl->getPropertyWrapperStorageWrapper();
|
||||
if (!storageWrapper)
|
||||
return None;
|
||||
|
||||
return std::make_pair(decl, decl->getPropertyWrapperBackingPropertyType());
|
||||
return std::make_pair(storageWrapper,
|
||||
storageWrapper->getInterfaceType());
|
||||
});
|
||||
}
|
||||
|
||||
Optional<std::pair<VarDecl *, Type>>
|
||||
ConstraintSystem::getPropertyWrapperInformation(
|
||||
SelectedOverload resolvedOverload) {
|
||||
return getPropertyWrapperInformationFromOverload(
|
||||
resolvedOverload, DC, [](VarDecl *decl) {
|
||||
return getPropertyWrapperInformationFromDecl(decl);
|
||||
resolvedOverload, DC,
|
||||
[](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
|
||||
if (!decl->hasAttachedPropertyWrapper())
|
||||
return None;
|
||||
|
||||
return std::make_pair(decl,
|
||||
decl->getPropertyWrapperBackingPropertyType());
|
||||
});
|
||||
}
|
||||
|
||||
static Optional<std::pair<VarDecl *, Type>>
|
||||
getWrappedPropertyInformationFromDecl(VarDecl *decl) {
|
||||
if (auto wrapped = decl->getOriginalWrappedProperty())
|
||||
return std::make_pair(decl, wrapped->getInterfaceType());
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
Optional<std::pair<VarDecl *, Type>>
|
||||
ConstraintSystem::getWrappedPropertyInformation(
|
||||
SelectedOverload resolvedOverload) {
|
||||
return getPropertyWrapperInformationFromOverload(
|
||||
resolvedOverload, DC, [](VarDecl *decl) {
|
||||
return getWrappedPropertyInformationFromDecl(decl);
|
||||
resolvedOverload, DC,
|
||||
[](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
|
||||
if (auto wrapped = decl->getOriginalWrappedProperty())
|
||||
return std::make_pair(decl, wrapped->getInterfaceType());
|
||||
|
||||
return None;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user