mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -3440,39 +3440,6 @@ AnyFunctionType *AnyFunctionType::withExtInfo(ExtInfo info) const {
|
||||
getParams(), getResult(), info);
|
||||
}
|
||||
|
||||
void AnyFunctionType::decomposeTuple(
|
||||
Type type, SmallVectorImpl<AnyFunctionType::Param> &result) {
|
||||
switch (type->getKind()) {
|
||||
case TypeKind::Tuple: {
|
||||
auto tupleTy = cast<TupleType>(type.getPointer());
|
||||
for (auto &elt : tupleTy->getElements()) {
|
||||
result.emplace_back((elt.isVararg()
|
||||
? elt.getVarargBaseTy()
|
||||
: elt.getRawType()),
|
||||
elt.getName(),
|
||||
elt.getParameterFlags());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case TypeKind::Paren: {
|
||||
auto pty = cast<ParenType>(type.getPointer());
|
||||
result.emplace_back(pty->getUnderlyingType()->getInOutObjectType(),
|
||||
Identifier(),
|
||||
pty->getParameterFlags());
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
result.emplace_back(
|
||||
type->getInOutObjectType(), Identifier(),
|
||||
ParameterTypeFlags::fromParameterType(type, false, false, false,
|
||||
ValueOwnership::Default, false,
|
||||
false));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Type AnyFunctionType::Param::getParameterType(bool forCanonical,
|
||||
ASTContext *ctx) const {
|
||||
Type type = getPlainType();
|
||||
@@ -3526,11 +3493,11 @@ bool AnyFunctionType::equalParams(CanParamArrayRef a, CanParamArrayRef b) {
|
||||
}
|
||||
|
||||
void AnyFunctionType::relabelParams(MutableArrayRef<Param> params,
|
||||
ArrayRef<Identifier> labels) {
|
||||
assert(params.size() == labels.size());
|
||||
ArgumentList *argList) {
|
||||
assert(params.size() == argList->size());
|
||||
for (auto i : indices(params)) {
|
||||
auto ¶m = params[i];
|
||||
param = AnyFunctionType::Param(param.getPlainType(), labels[i],
|
||||
param = AnyFunctionType::Param(param.getPlainType(), argList->getLabel(i),
|
||||
param.getParameterFlags(),
|
||||
param.getInternalLabel());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user