Skip to content

Commit 7d3b5be

Browse files
committed
pr comments
Signed-off-by: David Vulakh <[email protected]>
1 parent 4b3a6cd commit 7d3b5be

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/analysis/stack_or_heap_enclosing.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ type stack_or_heap =
1111
type stack_or_heap_enclosings = (Location.t * stack_or_heap) list
1212

1313
let from_nodes ~lsp_compat ~pos ~path =
14-
let[@tail_mod_cons] rec tails = function
15-
| hd :: tl -> (hd, tl) :: tails tl
14+
let[@tail_mod_cons] rec with_parents = function
15+
| node :: parent :: rest -> (node, Some parent) :: with_parents (parent :: rest)
16+
| [ node ] -> [ node, None ]
1617
| [] -> []
1718
in
1819
let cursor_is_inside ({ loc_start; loc_end; _ } : Location.t) =
1920
Lexing.compare_pos pos loc_start >= 0 && Lexing.compare_pos pos loc_end <= 0
2021
in
21-
let aux node parent =
22+
let aux (node, parent) =
2223
let open Browse_raw in
2324
let ret ?(loc = Mbrowse.node_loc node) mode_result =
2425
Some (loc, mode_result)
@@ -117,6 +118,5 @@ let from_nodes ~lsp_compat ~pos ~path =
117118
in
118119
path
119120
|> List.map ~f:(fun (_, node, _) -> node)
120-
|> tails
121-
|> List.filter_map ~f:(fun (node, ancestors) ->
122-
aux node (List.nth_opt ancestors 0))
121+
|> with_parents
122+
|> List.filter_map ~f:aux

0 commit comments

Comments
 (0)