mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #32107 from LucianoPAlmeida/nfc-move-to-cpp
[NFC][ConstraintSystem] Move some inlined header methods to implementation file
This commit is contained in:
@@ -955,6 +955,72 @@ TypeVariableType *ConstraintSystem::isRepresentativeFor(
|
||||
return *member;
|
||||
}
|
||||
|
||||
static Optional<std::pair<VarDecl *, Type>>
|
||||
getPropertyWrapperInformationFromOverload(
|
||||
SelectedOverload resolvedOverload, DeclContext *DC,
|
||||
llvm::function_ref<Optional<std::pair<VarDecl *, Type>>(VarDecl *)>
|
||||
getInformation) {
|
||||
if (auto *decl =
|
||||
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);
|
||||
}
|
||||
return std::make_pair(decl, type);
|
||||
}
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
||||
Optional<std::pair<VarDecl *, Type>>
|
||||
ConstraintSystem::getStorageWrapperInformation(
|
||||
SelectedOverload resolvedOverload) {
|
||||
return getPropertyWrapperInformationFromOverload(
|
||||
resolvedOverload, DC,
|
||||
[](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
|
||||
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::getPropertyWrapperInformation(
|
||||
SelectedOverload resolvedOverload) {
|
||||
return getPropertyWrapperInformationFromOverload(
|
||||
resolvedOverload, DC,
|
||||
[](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
|
||||
if (!decl->hasAttachedPropertyWrapper())
|
||||
return None;
|
||||
|
||||
return std::make_pair(decl,
|
||||
decl->getPropertyWrapperBackingPropertyType());
|
||||
});
|
||||
}
|
||||
|
||||
Optional<std::pair<VarDecl *, Type>>
|
||||
ConstraintSystem::getWrappedPropertyInformation(
|
||||
SelectedOverload resolvedOverload) {
|
||||
return getPropertyWrapperInformationFromOverload(
|
||||
resolvedOverload, DC,
|
||||
[](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
|
||||
if (auto wrapped = decl->getOriginalWrappedProperty())
|
||||
return std::make_pair(decl, wrapped->getInterfaceType());
|
||||
|
||||
return None;
|
||||
});
|
||||
}
|
||||
|
||||
/// Does a var or subscript produce an l-value?
|
||||
///
|
||||
/// \param baseType - the type of the base on which this object
|
||||
|
||||
Reference in New Issue
Block a user