@@ -934,72 +934,63 @@ getPropertyWrapperInformationFromOverload(
934
934
llvm::function_ref<Optional<std::pair<VarDecl *, Type>>(VarDecl *)>
935
935
getInformation) {
936
936
if (auto *decl =
937
- dyn_cast_or_null<VarDecl>(resolvedOverload.choice .getDeclOrNull ())) {
937
+ dyn_cast_or_null<VarDecl>(resolvedOverload.choice .getDeclOrNull ())) {
938
938
if (auto declInformation = getInformation (decl)) {
939
939
Type type;
940
940
VarDecl *memberDecl;
941
941
std::tie (memberDecl, type) = *declInformation;
942
942
if (Type baseType = resolvedOverload.choice .getBaseType ()) {
943
- type = baseType-> getTypeOfMember (DC-> getParentModule (), memberDecl,
944
- type);
943
+ type =
944
+ baseType-> getTypeOfMember (DC-> getParentModule (), memberDecl, type);
945
945
}
946
946
return std::make_pair (decl, type);
947
947
}
948
948
}
949
949
return None;
950
950
}
951
951
952
- static Optional<std::pair<VarDecl *, Type>>
953
- getStorageWrapperInformationFromDecl (VarDecl *decl) {
954
- if (!decl->hasAttachedPropertyWrapper ())
955
- return None;
956
-
957
- auto storageWrapper = decl->getPropertyWrapperStorageWrapper ();
958
- if (!storageWrapper)
959
- return None;
960
-
961
- return std::make_pair (storageWrapper, storageWrapper->getInterfaceType ());
962
- }
963
-
964
952
Optional<std::pair<VarDecl *, Type>>
965
953
ConstraintSystem::getStorageWrapperInformation (
966
954
SelectedOverload resolvedOverload) {
967
955
return getPropertyWrapperInformationFromOverload (
968
956
resolvedOverload, DC,
969
- [](VarDecl *decl) { return getStorageWrapperInformationFromDecl (decl); });
970
- }
957
+ [](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
958
+ if (!decl->hasAttachedPropertyWrapper ())
959
+ return None;
971
960
972
- static Optional<std::pair<VarDecl *, Type>>
973
- getPropertyWrapperInformationFromDecl (VarDecl *decl) {
974
- if (!decl->hasAttachedPropertyWrapper ())
975
- return None;
961
+ auto storageWrapper = decl->getPropertyWrapperStorageWrapper ();
962
+ if (!storageWrapper)
963
+ return None;
976
964
977
- return std::make_pair (decl, decl->getPropertyWrapperBackingPropertyType ());
965
+ return std::make_pair (storageWrapper,
966
+ storageWrapper->getInterfaceType ());
967
+ });
978
968
}
979
969
980
970
Optional<std::pair<VarDecl *, Type>>
981
971
ConstraintSystem::getPropertyWrapperInformation (
982
972
SelectedOverload resolvedOverload) {
983
973
return getPropertyWrapperInformationFromOverload (
984
- resolvedOverload, DC, [](VarDecl *decl) {
985
- return getPropertyWrapperInformationFromDecl (decl);
986
- });
987
- }
988
-
989
- static Optional<std::pair<VarDecl *, Type>>
990
- getWrappedPropertyInformationFromDecl (VarDecl *decl) {
991
- if (auto wrapped = decl->getOriginalWrappedProperty ())
992
- return std::make_pair (decl, wrapped->getInterfaceType ());
974
+ resolvedOverload, DC,
975
+ [](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
976
+ if (!decl->hasAttachedPropertyWrapper ())
977
+ return None;
993
978
994
- return None;
979
+ return std::make_pair (decl,
980
+ decl->getPropertyWrapperBackingPropertyType ());
981
+ });
995
982
}
996
983
997
984
Optional<std::pair<VarDecl *, Type>>
998
985
ConstraintSystem::getWrappedPropertyInformation (
999
986
SelectedOverload resolvedOverload) {
1000
987
return getPropertyWrapperInformationFromOverload (
1001
- resolvedOverload, DC, [](VarDecl *decl) {
1002
- return getWrappedPropertyInformationFromDecl (decl);
988
+ resolvedOverload, DC,
989
+ [](VarDecl *decl) -> Optional<std::pair<VarDecl *, Type>> {
990
+ if (auto wrapped = decl->getOriginalWrappedProperty ())
991
+ return std::make_pair (decl, wrapped->getInterfaceType ());
992
+
993
+ return None;
1003
994
});
1004
995
}
1005
996
0 commit comments