mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix a couple cases of ArrayRef capturing compiler temps.
Use a SmallVector for scratch space to use to build the ArrayRefs instead.
This commit is contained in:
@@ -6143,12 +6143,17 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
|
||||
ArrayRef<Expr *> arguments;
|
||||
ArrayRef<TypeBase *> types;
|
||||
|
||||
SmallVector<Expr *, 1> Scratch;
|
||||
if (auto *TE = dyn_cast<TupleExpr>(CEA))
|
||||
arguments = TE->getElements();
|
||||
else if (auto *PE = dyn_cast<ParenExpr>(CEA))
|
||||
arguments = PE->getSubExpr();
|
||||
else
|
||||
arguments = apply->getArg();
|
||||
else if (auto *PE = dyn_cast<ParenExpr>(CEA)) {
|
||||
Scratch.push_back(PE->getSubExpr());
|
||||
arguments = makeArrayRef(Scratch);
|
||||
}
|
||||
else {
|
||||
Scratch.push_back(apply->getArg());
|
||||
arguments = makeArrayRef(Scratch);
|
||||
}
|
||||
|
||||
for (auto arg: arguments) {
|
||||
bool isNoEscape = false;
|
||||
|
||||
@@ -299,12 +299,17 @@ static void diagSyntacticUseRestrictions(TypeChecker &TC, const Expr *E,
|
||||
|
||||
// The argument is either a ParenExpr or TupleExpr.
|
||||
ArrayRef<Expr*> arguments;
|
||||
SmallVector<Expr *, 1> Scratch;
|
||||
if (auto *TE = dyn_cast<TupleExpr>(Arg))
|
||||
arguments = TE->getElements();
|
||||
else if (auto *PE = dyn_cast<ParenExpr>(Arg))
|
||||
arguments = PE->getSubExpr();
|
||||
else
|
||||
arguments = Call->getArg();
|
||||
else if (auto *PE = dyn_cast<ParenExpr>(Arg)) {
|
||||
Scratch.push_back(PE->getSubExpr());
|
||||
arguments = makeArrayRef(Scratch);
|
||||
}
|
||||
else {
|
||||
Scratch.push_back(Call->getArg());
|
||||
arguments = makeArrayRef(Scratch);
|
||||
}
|
||||
|
||||
// Check each argument.
|
||||
for (auto arg : arguments) {
|
||||
|
||||
Reference in New Issue
Block a user