mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[NFC] Refactor self type computation to return a Param
Remove a user of InOutType::get and flip a few users of FunctionType::get to pass Params instead of naked input types.
This commit is contained in:
@@ -159,26 +159,25 @@ static ValueDecl *deriveInitDecl(TypeChecker &tc, Decl *parentDecl,
|
||||
Type retInterfaceType =
|
||||
OptionalType::get(parentDC->getDeclaredInterfaceType());
|
||||
Type interfaceType = FunctionType::get(interfaceArgType, retInterfaceType);
|
||||
Type selfInterfaceType = initDecl->computeInterfaceSelfType();
|
||||
Type selfInitializerInterfaceType =
|
||||
initDecl->computeInterfaceSelfType(/*init*/ true);
|
||||
auto selfParam = computeSelfParam(initDecl);
|
||||
auto initSelfParam = computeSelfParam(initDecl, /*init*/ true);
|
||||
|
||||
Type allocIfaceType;
|
||||
Type initIfaceType;
|
||||
if (auto sig = parentDC->getGenericSignatureOfContext()) {
|
||||
initDecl->setGenericEnvironment(parentDC->getGenericEnvironmentOfContext());
|
||||
|
||||
allocIfaceType = GenericFunctionType::get(sig, selfInterfaceType,
|
||||
allocIfaceType = GenericFunctionType::get(sig, {selfParam},
|
||||
interfaceType,
|
||||
FunctionType::ExtInfo());
|
||||
initIfaceType = GenericFunctionType::get(sig, selfInitializerInterfaceType,
|
||||
initIfaceType = GenericFunctionType::get(sig, {initSelfParam},
|
||||
interfaceType,
|
||||
FunctionType::ExtInfo());
|
||||
} else {
|
||||
allocIfaceType = FunctionType::get(selfInterfaceType,
|
||||
interfaceType);
|
||||
initIfaceType = FunctionType::get(selfInitializerInterfaceType,
|
||||
interfaceType);
|
||||
allocIfaceType = FunctionType::get({selfParam},
|
||||
interfaceType, FunctionType::ExtInfo());
|
||||
initIfaceType = FunctionType::get({initSelfParam},
|
||||
interfaceType, FunctionType::ExtInfo());
|
||||
}
|
||||
initDecl->setInterfaceType(allocIfaceType);
|
||||
initDecl->setInitializerInterfaceType(initIfaceType);
|
||||
|
||||
Reference in New Issue
Block a user