@@ -514,26 +514,19 @@ void LabeledConditionalStmt::setCond(StmtCondition e) {
514
514
// / or `let self = self` condition.
515
515
// / - If `requiresCaptureListRef` is `true`, additionally requires that the
516
516
// / RHS of the self condition references a var defined in a capture list.
517
- // / - If `requireLoadExpr` is `true`, additionally requires that the RHS of
518
- // / the self condition is a `LoadExpr`.
519
517
bool LabeledConditionalStmt::rebindsSelf (ASTContext &Ctx,
520
- bool requiresCaptureListRef,
521
- bool requireLoadExpr) const {
522
- return llvm::any_of (getCond (), [&Ctx, requiresCaptureListRef,
523
- requireLoadExpr](const auto &cond) {
524
- return cond.rebindsSelf (Ctx, requiresCaptureListRef, requireLoadExpr);
518
+ bool requiresCaptureListRef) const {
519
+ return llvm::any_of (getCond (), [&Ctx, requiresCaptureListRef](const auto &cond) {
520
+ return cond.rebindsSelf (Ctx, requiresCaptureListRef);
525
521
});
526
522
}
527
523
528
524
// / Whether or not this conditional stmt rebinds self with a `let self`
529
525
// / or `let self = self` condition.
530
526
// / - If `requiresCaptureListRef` is `true`, additionally requires that the
531
527
// / RHS of the self condition references a var defined in a capture list.
532
- // / - If `requireLoadExpr` is `true`, additionally requires that the RHS of
533
- // / the self condition is a `LoadExpr`.
534
528
bool StmtConditionElement::rebindsSelf (ASTContext &Ctx,
535
- bool requiresCaptureListRef,
536
- bool requireLoadExpr) const {
529
+ bool requiresCaptureListRef) const {
537
530
auto pattern = getPatternOrNull ();
538
531
if (!pattern) {
539
532
return false ;
@@ -561,10 +554,6 @@ bool StmtConditionElement::rebindsSelf(ASTContext &Ctx,
561
554
return false ;
562
555
}
563
556
564
- if (requireLoadExpr && !isa<LoadExpr>(exprToCheckForDRE)) {
565
- return false ;
566
- }
567
-
568
557
if (auto *load = dyn_cast<LoadExpr>(exprToCheckForDRE)) {
569
558
exprToCheckForDRE = load->getSubExpr ();
570
559
}
0 commit comments