File tree Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Expand file tree Collapse file tree 1 file changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -482,27 +482,22 @@ bool StmtConditionElement::rebindsSelf(ASTContext &Ctx,
482482 return false ;
483483 }
484484
485- // The RHS could be a `LoadExpr` or `DeclRefExpr`
486- Expr *loadExprSubExpr = nullptr ;
487- if (auto LE = dyn_cast<LoadExpr>(exprToCheckForDRE)) {
488- loadExprSubExpr = LE->getSubExpr ();
485+ if (requireLoadExpr && !isa<LoadExpr>(exprToCheckForDRE)) {
486+ return false ;
489487 }
490488
491- if (requireLoadExpr) {
492- exprToCheckForDRE = loadExprSubExpr;
493- } else {
494- if (loadExprSubExpr) {
495- exprToCheckForDRE = loadExprSubExpr;
496- }
497- exprToCheckForDRE = exprToCheckForDRE->getSemanticsProvidingExpr ();
489+ if (auto *load = dyn_cast<LoadExpr>(exprToCheckForDRE)) {
490+ exprToCheckForDRE = load->getSubExpr ();
498491 }
499492
500- DeclRefExpr *condDRE = dyn_cast_or_null<DeclRefExpr>(exprToCheckForDRE);
501- if (!condDRE || !condDRE->getDecl ()->hasName ()) {
502- return false ;
493+ if (auto *DRE = dyn_cast<DeclRefExpr>(
494+ exprToCheckForDRE->getSemanticsProvidingExpr ())) {
495+ auto *decl = DRE->getDecl ();
496+ return decl && decl->hasName () ? decl->getName ().isSimpleName (Ctx.Id_self )
497+ : false ;
503498 }
504499
505- return condDRE-> getDecl ()-> getName (). isSimpleName (Ctx. Id_self ) ;
500+ return false ;
506501}
507502
508503PoundAvailableInfo *
You can’t perform that action at this time.
0 commit comments