Skip to content

Commit 4028130

Browse files
committed
Wrap in parens only self as ptr expression
1 parent 0f2f066 commit 4028130

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,6 +3094,7 @@ bool Converter::VisitCXXThisExpr(clang::CXXThisExpr *expr) {
30943094
if (clang::isa<clang::CXXConstructorDecl>(curr_function_)) {
30953095
StrCat("&raw mut this");
30963096
} else {
3097+
PushParen paren(*this);
30973098
StrCat(keyword::kSelfValue, keyword::kAs, ToString(expr->getType()));
30983099
}
30993100
return false;
@@ -4368,9 +4369,7 @@ void Converter::EmitDeref(std::string inner, clang::QualType pointee_type) {
43684369
StrCat(*wrap ? "&mut" : "&");
43694370
}
43704371
PushParen paren(*this);
4371-
StrCat(GetPointerDerefPrefix(pointee_type));
4372-
PushParen inner_paren(*this);
4373-
StrCat(std::move(inner));
4372+
StrCat(GetPointerDerefPrefix(pointee_type), std::move(inner));
43744373
}
43754374

43764375
void Converter::ConvertDeref(clang::Expr *expr) {

0 commit comments

Comments
 (0)