AST: Rename old form of {Generic,}FunctionType::get() to getOld()

This makes it easier to grep for and eventually remove the
remaining usages.

It also allows you to write FunctionType::get({}, ...) to call the
ArrayRef overload empty parameter list, instead of picking the Type
overload and calling it with an empty Type() value.

While I"m at it, in a few places instead of renaming just clean up
usages where it was completely mechanical to do so.
This commit is contained in:
Slava Pestov
2018-08-16 00:35:17 -07:00
parent a54251074c
commit 527ff375dc
28 changed files with 237 additions and 225 deletions

View File

@@ -1357,10 +1357,10 @@ void TypeChecker::completePropertyBehaviorStorage(VarDecl *VD,
auto InitStorageRef = new (Context) DeclRefExpr(SpecializeInitStorage,
DeclNameLoc(),
/*implicit*/ true);
auto InitStorageMethodTy = FunctionType::get(Context.TheEmptyTupleType,
SubstStorageContextTy);
auto InitStorageRefTy = FunctionType::get(SelfTypeRef->getType(),
InitStorageMethodTy);
auto InitStorageMethodTy = FunctionType::get({}, SubstStorageContextTy);
FunctionType::Param SelfParam(SelfTypeRef->getType());
auto InitStorageRefTy = FunctionType::get({SelfParam}, InitStorageMethodTy);
InitStorageRef->setType(InitStorageRefTy);
auto SelfApply = new (Context) DotSyntaxCallExpr(InitStorageRef,
@@ -1467,15 +1467,16 @@ void TypeChecker::completePropertyBehaviorParameter(VarDecl *VD,
// Add the Self type back to the interface and context types.
if (DC->isTypeContext()) {
FunctionType::Param SelfParam(DC->getSelfInterfaceType());
if (DC->isGenericContext()) {
genericSig = DC->getGenericSignatureOfContext();
genericEnv = DC->getGenericEnvironmentOfContext();
SubstInterfaceTy = GenericFunctionType::get(genericSig,
DC->getSelfInterfaceType(),
SubstInterfaceTy);
SubstInterfaceTy =
GenericFunctionType::get(genericSig, {SelfParam}, SubstInterfaceTy);
} else {
SubstInterfaceTy = FunctionType::get(DC->getSelfInterfaceType(),
SubstInterfaceTy);
SubstInterfaceTy =
FunctionType::get({SelfParam}, SubstInterfaceTy);
}
}