@@ -2973,9 +2973,8 @@ void Converter::ConvertVarInit(clang::QualType qual_type, clang::Expr *expr) {
29732973 if (auto *lambda = clang::dyn_cast<clang::LambdaExpr>(
29742974 expr->IgnoreUnlessSpelledInSource ())) {
29752975 PushExprKind push (*this , ExprKind::AddrOf);
2976- curr_init_type_. push ( qual_type);
2976+ PushInitType init_type (* this , qual_type);
29772977 VisitLambdaExpr (lambda);
2978- curr_init_type_.pop ();
29792978 return ;
29802979 }
29812980 }
@@ -2992,21 +2991,18 @@ void Converter::ConvertVarInit(clang::QualType qual_type, clang::Expr *expr) {
29922991 {
29932992 PushParen paren (*this );
29942993 StrCat (token::kStar );
2995- curr_init_type_. push ( qual_type);
2994+ PushInitType init_type (* this , qual_type);
29962995 Convert (expr);
2997- curr_init_type_.pop ();
29982996 }
29992997 StrCat (" .clone()" );
30002998 } else if (IsReferenceType (expr) || qual_type->isFunctionPointerType ()) {
30012999 PushExprKind push (*this , ExprKind::AddrOf);
3002- curr_init_type_. push ( qual_type);
3000+ PushInitType init_type (* this , qual_type);
30033001 Convert (expr);
3004- curr_init_type_.pop ();
30053002 } else {
30063003 PushExprKind push (*this , ExprKind::RValue);
3007- curr_init_type_. push ( qual_type);
3004+ PushInitType init_type (* this , qual_type);
30083005 Convert (expr);
3009- curr_init_type_.pop ();
30103006 }
30113007 if (qual_type->isReferenceType () && !IsReferenceType (expr)) {
30123008 StrCat (keyword::kAs );
@@ -3080,9 +3076,11 @@ void Converter::ConvertArraySubscript(clang::Expr *base, clang::Expr *idx,
30803076
30813077void Converter::ConvertAssignment (clang::Expr *lhs, clang::Expr *rhs,
30823078 std::string_view assign_operator) {
3083- curr_init_type_.push (lhs->getType ());
3084- auto lhs_as_string = ConvertLValue (lhs);
3085- curr_init_type_.pop ();
3079+ std::string lhs_as_string;
3080+ {
3081+ PushInitType init_type (*this , lhs->getType ());
3082+ lhs_as_string = ConvertLValue (lhs);
3083+ }
30863084 auto rhs_as_string = ConvertFreshRValue (rhs);
30873085
30883086 PushBrace brace (*this , !isVoid ());
0 commit comments