Skip to content

Commit 32e314d

Browse files
committed
Fix removing parens for in-place objects fix #331
That should cover cases: ```cpp f1(:std::vector=(1,2,3)); f2(:std::vector=(1,2,3),:std::vector=(4,5)); ar[:index=(1,2)]; ar2[:index=(1,2), :index=(2,1)]; ``` that will generate: ```cpp f1(std::vector{1, 2, 3}); f2(std::vector{1, 2, 3}, std::vector{4, 5}); cpp2::assert_in_bounds(ar, index{1, 2}); cpp2::assert_in_bounds(ar2, index{1, 2}, index{2, 1}); ```
1 parent dd8f668 commit 32e314d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/parse.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,12 @@ class parser
28722872
}
28732873
expr_list->close_paren = &curr();
28742874
next();
2875-
if (curr().type() != lexeme::Semicolon) {
2875+
if (
2876+
curr().type() != lexeme::Semicolon
2877+
&& curr().type() != lexeme::RightParen
2878+
&& curr().type() != lexeme::RightBracket
2879+
&& curr().type() != lexeme::Comma
2880+
) {
28762881
expr_list->inside_initializer = false;
28772882
}
28782883
n->expr = std::move(expr_list);

0 commit comments

Comments
 (0)