File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -1228,13 +1228,30 @@ UnresolvedSpecializeExpr *UnresolvedSpecializeExpr::create(ASTContext &ctx,
12281228}
12291229
12301230bool CaptureListEntry::isSimpleSelfCapture () const {
1231+ auto &ctx = Var->getASTContext ();
1232+
1233+ if (Var->getName () != ctx.Id_self )
1234+ return false ;
1235+
1236+ if (auto *attr = Var->getAttrs ().getAttribute <ReferenceOwnershipAttr>())
1237+ if (attr->get () == ReferenceOwnership::Weak)
1238+ return false ;
1239+
12311240 if (Init->getPatternList ().size () != 1 )
12321241 return false ;
1233- if (auto *DRE = dyn_cast<DeclRefExpr>(Init->getInit (0 )))
1242+
1243+ auto *expr = Init->getInit (0 );
1244+
1245+ if (auto *DRE = dyn_cast<DeclRefExpr>(expr)) {
12341246 if (auto *VD = dyn_cast<VarDecl>(DRE->getDecl ())) {
1235- return (VD->isSelfParameter () || VD->isSelfParamCapture ())
1236- && VD->getName () == Var->getName ();
1247+ return VD->getName () == ctx.Id_self ;
12371248 }
1249+ }
1250+
1251+ if (auto *UDRE = dyn_cast<UnresolvedDeclRefExpr>(expr)) {
1252+ return UDRE->getName ().isSimpleName (ctx.Id_self );
1253+ }
1254+
12381255 return false ;
12391256}
12401257
You can’t perform that action at this time.
0 commit comments