Skip to content
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

Fix location of let bindings with attributes #6791

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#### :house: Internal

- Convert OCaml codebase to snake case style. https://github.com/rescript-lang/rescript-compiler/pull/6702
- Fix location of let bindings with attributes. https://github.com/rescript-lang/rescript-compiler/pull/6791

#### :boom: Breaking Change

Expand Down
7 changes: 3 additions & 4 deletions jscomp/syntax/src/res_core.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2574,8 +2574,7 @@ and parse_attributes_and_binding (p : Parser.t) =
| _ -> []

(* definition ::= let [rec] let-binding { and let-binding } *)
and parse_let_bindings ~attrs p =
let start_pos = p.Parser.start_pos in
and parse_let_bindings ~attrs ~start_pos p =
Parser.optional p Let |> ignore;
let rec_flag =
if Parser.optional p Token.Rec then Asttypes.Recursive
Expand Down Expand Up @@ -3249,7 +3248,7 @@ and parse_expr_block_item p =
let loc = mk_loc start_pos p.prev_end_pos in
Ast_helper.Exp.open_ ~loc od.popen_override od.popen_lid block_expr
| Let ->
let rec_flag, let_bindings = parse_let_bindings ~attrs p in
let rec_flag, let_bindings = parse_let_bindings ~attrs ~start_pos p in
parse_newline_or_semicolon_expr_block p;
let next =
if Grammar.is_block_expr_start p.Parser.token then parse_expr_block p
Expand Down Expand Up @@ -5693,7 +5692,7 @@ and parse_structure_item_region p =
let loc = mk_loc start_pos p.prev_end_pos in
Some (Ast_helper.Str.open_ ~loc open_description)
| Let ->
let rec_flag, let_bindings = parse_let_bindings ~attrs p in
let rec_flag, let_bindings = parse_let_bindings ~attrs ~start_pos p in
parse_newline_or_semicolon_structure p;
let loc = mk_loc start_pos p.prev_end_pos in
Some (Ast_helper.Str.value ~loc rec_flag let_bindings)
Expand Down
Loading