AST: Remove a few usages of TypeBase::getInOutObjectType()

This commit is contained in:
Slava Pestov
2018-08-12 23:38:16 -07:00
parent 31a570d53c
commit d31d35a788
7 changed files with 20 additions and 26 deletions

View File

@@ -1982,12 +1982,7 @@ static Type mapSignatureFunctionType(ASTContext &ctx, Type type,
if (curryLevels == 0) {
// In an initializer, ignore optionality.
if (isInitializer) {
if (auto inOutTy = type->getAs<InOutType>()) {
if (auto objectType =
inOutTy->getObjectType()->getOptionalObjectType()) {
type = InOutType::get(objectType);
}
} else if (auto objectType = type->getOptionalObjectType()) {
if (auto objectType = type->getOptionalObjectType()) {
type = objectType;
}
}
@@ -1998,7 +1993,7 @@ static Type mapSignatureFunctionType(ASTContext &ctx, Type type,
auto funcTy = type->castTo<AnyFunctionType>();
SmallVector<AnyFunctionType::Param, 4> newParams;
for (const auto &param : funcTy->getParams()) {
auto newParamType = mapSignatureParamType(ctx, param.getType());
auto newParamType = mapSignatureParamType(ctx, param.getPlainType());
ParameterTypeFlags newFlags = param.getParameterFlags().withEscaping(false);
// For the 'self' of a method, strip off 'inout'.
@@ -2006,8 +2001,7 @@ static Type mapSignatureFunctionType(ASTContext &ctx, Type type,
newFlags = newFlags.withInOut(false);
}
AnyFunctionType::Param newParam(newParamType->getInOutObjectType(),
param.getLabel(), newFlags);
AnyFunctionType::Param newParam(newParamType, param.getLabel(), newFlags);
newParams.push_back(newParam);
}
@@ -4721,7 +4715,7 @@ ParamDecl::ParamDecl(ParamDecl *PD, bool withTypes)
typeLoc.setType(Type());
if (withTypes && PD->hasInterfaceType())
setInterfaceType(PD->getInterfaceType()->getInOutObjectType());
setInterfaceType(PD->getInterfaceType());
// FIXME: We should clone the entire attribute list.
if (PD->getAttrs().hasAttribute<ImplicitlyUnwrappedOptionalAttr>())