File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed
Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -1453,7 +1453,19 @@ and print_record =
14531453 };
14541454
14551455 let after_brace_comments =
1456- Comment_utils . get_after_brace_comments(~loc= recloc, comments);
1456+ switch (fields) {
1457+ | [ field , ... _ ] =>
1458+ let (ident , expr ) = field;
1459+
1460+ Comment_utils . get_after_brace_comments(
1461+ ~loc= recloc,
1462+ ~first= ident. loc,
1463+ comments,
1464+ );
1465+
1466+ | _ => Comment_utils . get_after_brace_comments(~loc= recloc, comments) // let s = {} is not legal syntax, but we can use all the comments
1467+ };
1468+
14571469 let cleaned_comments =
14581470 remove_used_comments(~remove_comments= after_brace_comments, comments);
14591471
Original file line number Diff line number Diff line change @@ -60,3 +60,16 @@ let { // a comment 3
6060 l2,
6161 l3
6262} = x
63+
64+ let s= { num: 1, var: A, // end line comment
65+ str: "" }
66+
67+
68+ let s= { num: 1,
69+ var: A, // end line comment
70+ str: "" }
71+
72+ let s= { // comment 1
73+ // comment 2
74+ num: 1, var: A, // end line comment
75+ str: "" }
Original file line number Diff line number Diff line change @@ -75,3 +75,22 @@ let { // a comment 3
7575 l2,
7676 l3,
7777} = x
78+
79+ let s = {
80+ num: 1,
81+ var: A, // end line comment
82+ str: "",
83+ }
84+
85+ let s = {
86+ num: 1,
87+ var: A, // end line comment
88+ str: "",
89+ }
90+
91+ let s = { // comment 1
92+ // comment 2
93+ num: 1,
94+ var: A, // end line comment
95+ str: "",
96+ }
You can’t perform that action at this time.
0 commit comments