Skip to content
Open
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 changes/sourcemap-pattern-match-branches.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Emit accurate source map mappings for pattern-match arms, branch dispatch tests, `if`/`else` expressions, and block boundaries, fixing missing mappings for constant- and variable-returning arms and improving coverage reporting through source maps.
2 changes: 2 additions & 0 deletions compiler/backend/ext_pp.mli
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ val in_operator_forbidden : t -> bool

val newline : t -> unit

val force_newline : t -> unit

val at_least_two_lines : t -> unit

val from_channel : ?track_positions:bool -> out_channel -> t
Expand Down
8 changes: 7 additions & 1 deletion compiler/backend/js_analyzer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,13 @@ and eq_statement ({statement_desc = x0} : J.statement)
let rev_flatten_seq (x : J.expression) =
let rec aux acc (x : J.expression) : J.block =
match x.expression_desc with
| Seq (a, b) -> aux (aux acc a) b
| Seq (a, b) ->
let a =
match (x.source_loc, a.source_loc) with
| Some _, None -> {a with source_loc = x.source_loc}
| _ -> a
in
aux (aux acc a) b
| _ -> {statement_desc = Exp x; comment = None; source_loc = None} :: acc
in
aux [] x
Expand Down
Loading
Loading