Skip to content

Commit 026e27d

Browse files
committed
Remove infix in FindFiles.
1 parent d04ed89 commit 026e27d

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

analysis/src/FindFiles.ml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@ let ( /+ ) = Filename.concat
44

55
(* Returns a list of paths, relative to the provided `base` *)
66
let getSourceDirectories ~includeDev ~baseDir config =
7-
let open Infix in
87
let rec handleItem current item =
98
match item with
109
| Json.Array contents ->
1110
List.map (handleItem current) contents |> List.concat
1211
| Json.String text -> [current /+ text]
1312
| Json.Object _ -> (
1413
let dir =
15-
Json.get "dir" item |?> Json.string |? "Must specify directory"
14+
Json.string
15+
|> Option.bind (item |> Json.get "dir")
16+
|> Option.value ~default:"Must specify directory"
1617
in
1718
let typ =
1819
if includeDev then "lib"
19-
else item |> Json.get "type" |?> Json.string |? "lib"
20+
else
21+
Json.string
22+
|> Option.bind (item |> Json.get "type")
23+
|> Option.value ~default:"lib"
2024
in
25+
2126
if typ = "dev" then []
2227
else
2328
match item |> Json.get "subdirs" with
@@ -191,12 +196,13 @@ let findDependencyFiles base config =
191196
let open Infix in
192197
let deps =
193198
config |> Json.get "bs-dependencies" |?> Json.array |? []
194-
|> List.filter_map Json.string
199+
|> List.filter_map Json.string
195200
in
196201
let devDeps =
197202
config
198203
|> Json.get "bs-dev-dependencies"
199-
|?> Json.array |? [] |> List.filter_map Json.string
204+
|?> Json.array |? []
205+
|> List.filter_map Json.string
200206
in
201207
let deps = deps @ devDeps in
202208
Log.log ("Dependencies: " ^ String.concat " " deps);

analysis/src/Scope.ml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@ let itemToString item =
1818
| Module (s, loc) -> "Module " ^ s ^ " " ^ Loc.toString loc
1919
| Value (s, loc) -> "Value " ^ s ^ " " ^ Loc.toString loc
2020
| Type (s, loc) -> "Type " ^ s ^ " " ^ Loc.toString loc
21+
[@@live]
2122

2223
let create () : t = []
24+
2325
let addConstructor ~name ~loc x = Constructor (name, loc) :: x
26+
2427
let addField ~name ~loc x = Field (name, loc) :: x
28+
2529
let addModule ~name ~loc x = Module (name, loc) :: x
30+
2631
let addOpen ~lid x = Open (Utils.flattenLongIdent lid @ ["place holder"]) :: x
32+
2733
let addValue ~name ~loc x = Value (name, loc) :: x
34+
2835
let addType ~name ~loc x = Type (name, loc) :: x
2936

3037
let iterValuesBeforeFirstOpen f x =

0 commit comments

Comments
 (0)