File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -4885,16 +4885,27 @@ and parse_constr_decl_args p =
4885
4885
* | constr-name const-args
4886
4886
* | attrs constr-name const-args *)
4887
4887
and parse_type_constructor_declaration_with_bar p =
4888
- let doc_comment_attrs =
4889
- match p.Parser. token with
4890
- | DocComment (loc , s ) ->
4891
- Parser. next p;
4892
- [doc_comment_to_attribute loc s]
4893
- | _ -> []
4888
+ let is_constructor_with_bar p =
4889
+ Parser. lookahead p (fun state ->
4890
+ match state.Parser. token with
4891
+ | DocComment _ -> (
4892
+ Parser. next state;
4893
+ match state.token with
4894
+ | Bar -> true
4895
+ | _ -> false )
4896
+ | Bar -> true
4897
+ | _ -> false )
4894
4898
in
4895
- let has_doc_comment = not (doc_comment_attrs = [] ) in
4896
4899
match p.Parser. token with
4897
- | Bar ->
4900
+ | _ when is_constructor_with_bar p ->
4901
+ let doc_comment_attrs =
4902
+ match p.Parser. token with
4903
+ | DocComment (loc , s ) ->
4904
+ Parser. next p;
4905
+ [doc_comment_to_attribute loc s]
4906
+ | _ -> []
4907
+ in
4908
+ let has_doc_comment = not (doc_comment_attrs = [] ) in
4898
4909
let start_pos = p.Parser. start_pos in
4899
4910
Parser. next p;
4900
4911
let constr = parse_type_constructor_declaration ~start_pos p in
@@ -4946,6 +4957,7 @@ and parse_type_constructor_declarations ?first p =
4946
4957
let first_constr_decl =
4947
4958
match first with
4948
4959
| None ->
4960
+ (* bar *)
4949
4961
let doc_comment_attrs =
4950
4962
match p.Parser. token with
4951
4963
| DocComment (loc , s ) ->
You can’t perform that action at this time.
0 commit comments