SIL: Simplify AbstractionPattern::getFunctionParamType()

Use the new AnyFunctionType::Param::getParameterType() method
John added, instead of encoding knowledge of varargs directly
here.

Also don't wrap the result in an InOutType since for now,
clients only use this for Objective-C methods which don't
have inout parameters, and upcoming usages need the unwrapped
type anyway.
This commit is contained in:
Slava Pestov
2018-09-13 13:24:18 -07:00
parent ac4a92a968
commit 9092da33f8

View File

@@ -798,15 +798,8 @@ AbstractionPattern::getFunctionParamType(unsigned index) const {
return AbstractionPattern::getOpaque();
auto fnType = cast<AnyFunctionType>(getType());
auto param = fnType.getParams()[index];
auto paramType = param.getType();
// FIXME: Extract this into a utility method
if (param.isVariadic()) {
auto &ctx = paramType->getASTContext();
paramType = CanType(BoundGenericType::get(ctx.getArrayDecl(),
Type(), {paramType}));
}
return AbstractionPattern(getGenericSignatureForFunctionComponent(),
paramType);
param.getParameterType());
}
default:
// FIXME: Re-implement this