Skip to content

Commit 726c605

Browse files
committed
Slightly more code reuse
1 parent 9c2c72d commit 726c605

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/analysis/outline.ml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,8 @@ and get_val_elements node =
157157
match node.t_node with
158158
| Expression _ ->
159159
List.concat_map (Lazy.force node.t_children) ~f:get_val_elements
160-
| Value_binding vb ->
161-
let children =
162-
List.concat_map (Lazy.force node.t_children) ~f:get_val_elements
163-
in
164-
let deprecated = Type_utils.is_deprecated vb.vb_attributes in
165-
begin
166-
match id_of_patt vb.vb_pat with
167-
| None -> []
168-
| Some ident ->
169-
[ mk ~children ~location:node.t_loc ~deprecated `Value None ident ]
170-
end
171160
| Class_expr _ | Class_structure _ -> get_class_elements node
172-
| _ -> []
161+
| _ -> Option.to_list (summarize node)
173162

174163
and get_class_elements node =
175164
match node.t_node with

tests/test-dirs/outline.t/run.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
"name": "c",
2929
"kind": "Value",
30-
"type": null,
30+
"type": "< foo : int >",
3131
"children": [
3232
{
3333
"start": {
@@ -192,7 +192,7 @@
192192
},
193193
"name": "x_inside_a_b",
194194
"kind": "Value",
195-
"type": null,
195+
"type": "int",
196196
"children": [],
197197
"deprecated": false
198198
}

0 commit comments

Comments
 (0)