@@ -2225,21 +2225,21 @@ bool Converter::VisitConditionalOperator(clang::ConditionalOperator *expr) {
22252225 bool branch_is_addr =
22262226 expr->isLValue () && !isRValue () && !expr->getType ()->isFunctionType ();
22272227 {
2228- PushBrace brace (*this );
2228+ PushBrace then_brace (*this );
22292229 if (branch_is_addr) {
22302230 StrCat (token::kRef , keyword_mut_);
22312231 }
2232- PushExplicitAutoref no_autoref (*this , branch_is_addr ? std::optional< bool >{}
2232+ PushExplicitAutoref no_autoref (*this , branch_is_addr ? std::nullopt
22332233 : autoref_mut_);
22342234 Convert (expr->getTrueExpr ());
22352235 }
22362236 StrCat (keyword::kElse );
22372237 {
2238- PushBrace brace (*this );
2238+ PushBrace else_brace (*this );
22392239 if (branch_is_addr) {
22402240 StrCat (token::kRef , keyword_mut_);
22412241 }
2242- PushExplicitAutoref no_autoref (*this , branch_is_addr ? std::optional< bool >{}
2242+ PushExplicitAutoref no_autoref (*this , branch_is_addr ? std::nullopt
22432243 : autoref_mut_);
22442244 Convert (expr->getFalseExpr ());
22452245 }
@@ -2369,13 +2369,7 @@ bool Converter::ConvertCXXOperatorCallExpr(clang::CXXOperatorCallExpr *expr) {
23692369 }
23702370 break ;
23712371 case clang::OverloadedOperatorKind::OO_Subscript: {
2372- bool is_mut = true ;
2373- if (auto *callee = expr->getDirectCallee ()) {
2374- if (auto *method = clang::dyn_cast<clang::CXXMethodDecl>(callee)) {
2375- is_mut = !method->isConst ();
2376- }
2377- }
2378- PushExplicitAutoref autoref (*this , is_mut);
2372+ PushExplicitAutoref autoref (*this , IsMutatingCall (expr));
23792373 ConvertArraySubscript (expr->getArg (0 ), expr->getArg (1 ), expr->getType ());
23802374 break ;
23812375 }
0 commit comments