@@ -2946,9 +2946,8 @@ void Converter::ConvertVarInit(clang::QualType qual_type, clang::Expr *expr) {
29462946 if (auto *lambda = clang::dyn_cast<clang::LambdaExpr>(
29472947 expr->IgnoreUnlessSpelledInSource ())) {
29482948 PushExprKind push (*this , ExprKind::AddrOf);
2949- curr_init_type_. push ( qual_type);
2949+ PushInitType init_type (* this , qual_type);
29502950 VisitLambdaExpr (lambda);
2951- curr_init_type_.pop ();
29522951 return ;
29532952 }
29542953 }
@@ -2965,21 +2964,18 @@ void Converter::ConvertVarInit(clang::QualType qual_type, clang::Expr *expr) {
29652964 {
29662965 PushParen paren (*this );
29672966 StrCat (token::kStar );
2968- curr_init_type_. push ( qual_type);
2967+ PushInitType init_type (* this , qual_type);
29692968 Convert (expr);
2970- curr_init_type_.pop ();
29712969 }
29722970 StrCat (" .clone()" );
29732971 } else if (IsReferenceType (expr) || qual_type->isFunctionPointerType ()) {
29742972 PushExprKind push (*this , ExprKind::AddrOf);
2975- curr_init_type_. push ( qual_type);
2973+ PushInitType init_type (* this , qual_type);
29762974 Convert (expr);
2977- curr_init_type_.pop ();
29782975 } else {
29792976 PushExprKind push (*this , ExprKind::RValue);
2980- curr_init_type_. push ( qual_type);
2977+ PushInitType init_type (* this , qual_type);
29812978 Convert (expr);
2982- curr_init_type_.pop ();
29832979 }
29842980 if (qual_type->isReferenceType () && !IsReferenceType (expr)) {
29852981 StrCat (keyword::kAs );
@@ -3053,9 +3049,11 @@ void Converter::ConvertArraySubscript(clang::Expr *base, clang::Expr *idx,
30533049
30543050void Converter::ConvertAssignment (clang::Expr *lhs, clang::Expr *rhs,
30553051 std::string_view assign_operator) {
3056- curr_init_type_.push (lhs->getType ());
3057- auto lhs_as_string = ConvertLValue (lhs);
3058- curr_init_type_.pop ();
3052+ std::string lhs_as_string;
3053+ {
3054+ PushInitType init_type (*this , lhs->getType ());
3055+ lhs_as_string = ConvertLValue (lhs);
3056+ }
30593057 auto rhs_as_string = ConvertFreshRValue (rhs);
30603058
30613059 PushBrace brace (*this , !isVoid ());
0 commit comments