mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[NFC] Change forEachFunctionParam to only ignore the final orig parameter
and not also drop a subst parameter. This turned out to be more convenient for certain clients (e.g. SILGenPoly) than requiring the full subst param list to be passed in. These clients want to process the subst param list separately, and dropping self early can be convenient for that. The only fundamental reason we need this flag is for working with the orig type, so just use it for that; clients that need to use this feature can reasonably be expected to cooperate.
This commit is contained in:
@@ -1203,7 +1203,7 @@ unsigned AbstractionPattern::getNumFunctionParams() const {
|
||||
|
||||
void AbstractionPattern::
|
||||
forEachFunctionParam(AnyFunctionType::CanParamArrayRef substParams,
|
||||
bool ignoreFinalParam,
|
||||
bool ignoreFinalOrigParam,
|
||||
llvm::function_ref<void(unsigned origParamIndex,
|
||||
unsigned substParamIndex,
|
||||
ParameterTypeFlags origFlags,
|
||||
@@ -1216,7 +1216,7 @@ forEachFunctionParam(AnyFunctionType::CanParamArrayRef substParams,
|
||||
AbstractionPattern origExpansionType,
|
||||
AnyFunctionType::CanParamArrayRef substParams)>
|
||||
handleExpansion) const {
|
||||
FunctionParamGenerator generator(*this, substParams, ignoreFinalParam);
|
||||
FunctionParamGenerator generator(*this, substParams, ignoreFinalOrigParam);
|
||||
|
||||
for (; !generator.isFinished(); generator.advance()) {
|
||||
if (generator.isPackExpansion()) {
|
||||
@@ -1239,7 +1239,7 @@ forEachFunctionParam(AnyFunctionType::CanParamArrayRef substParams,
|
||||
FunctionParamGenerator::FunctionParamGenerator(
|
||||
AbstractionPattern origFunctionType,
|
||||
AnyFunctionType::CanParamArrayRef substParams,
|
||||
bool ignoreFinalParam)
|
||||
bool ignoreFinalOrigParam)
|
||||
: origFunctionType(origFunctionType), allSubstParams(substParams) {
|
||||
origFunctionTypeIsOpaque =
|
||||
(origFunctionType.isTypeParameterOrOpaqueArchetype() ||
|
||||
@@ -1249,11 +1249,8 @@ FunctionParamGenerator::FunctionParamGenerator(
|
||||
numOrigParams = allSubstParams.size();
|
||||
} else {
|
||||
numOrigParams = origFunctionType.getNumFunctionParams();
|
||||
}
|
||||
|
||||
if (ignoreFinalParam) {
|
||||
allSubstParams = allSubstParams.drop_back();
|
||||
numOrigParams--;
|
||||
if (ignoreFinalOrigParam)
|
||||
numOrigParams--;
|
||||
}
|
||||
|
||||
if (!isFinished()) loadParameter();
|
||||
|
||||
Reference in New Issue
Block a user