-
Notifications
You must be signed in to change notification settings - Fork 261
fix(cpp1): support assignment from expression list #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2465e13
to
4dff91c
Compare
// go through the whole grammar, and surround it with braces | ||
if ( | ||
x.op->type() == lexeme::Assignment | ||
&& x.expr->is_expression_list() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, but it needs
&& std::ssize(x.expr->get_expression_list()->expressions.size()) != 1
otherwise x = (move y);
will grow braces we don't need. I'll make the change directly and merge.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I was wrong -- we want those {
}
in other cases. Will revert my changes...
Added size check so we don't add `{` `}` around single-element lists Signed-off-by: Herb Sutter <herb.sutter@gmail.com>
`std::ssize` for consistency, and `!= 1` so we still emit `{` `}` around empty lists. Signed-off-by: Herb Sutter <herb.sutter@gmail.com>
Signed-off-by: Herb Sutter <herb.sutter@gmail.com>
Thanks! |
* fix(cpp1): support assignment from expression list * Update cppfront.cpp Added size check so we don't add `{` `}` around single-element lists Signed-off-by: Herb Sutter <herb.sutter@gmail.com> * Update cppfront.cpp `std::ssize` for consistency, and `!= 1` so we still emit `{` `}` around empty lists. Signed-off-by: Herb Sutter <herb.sutter@gmail.com> * Update cppfront.cpp Signed-off-by: Herb Sutter <herb.sutter@gmail.com> --------- Signed-off-by: Herb Sutter <herb.sutter@gmail.com> Co-authored-by: Herb Sutter <herb.sutter@gmail.com>
Resolves #321.
Resolves #449.
Now fixing #408 becomes necessary.
The reason is explained at #451 (comment):
Testing summary.
Acknowledgements.