|
1 | 1 | let defaultPrintWidth = 100
|
2 | 2 |
|
3 |
| -(* Determine if the file is in uncurried mode by looking for |
4 |
| - the fist ancestor .bsconfig and see if it contains "uncurried": false *) |
| 3 | +(* Look at bsconfig.json to set Uncurried or Legacy mode if it contains "uncurried": false *) |
5 | 4 | let getUncurriedFromBsconfig ~filename =
|
6 | 5 | let rec findBsconfig ~dir =
|
7 | 6 | let bsconfig = Filename.concat dir "bsconfig.json" in
|
@@ -38,25 +37,26 @@ let getUncurriedFromBsconfig ~filename =
|
38 | 37 | | None -> ()
|
39 | 38 | | Some bsconfig ->
|
40 | 39 | let lines = bsconfig |> String.split_on_char '\n' in
|
41 |
| - let uncurried = |
| 40 | + let is_legacy_uncurried = |
42 | 41 | lines
|
43 | 42 | |> List.exists (fun line ->
|
44 |
| - let uncurried = ref false in |
45 |
| - let false_ = ref false in |
| 43 | + let is_uncurried_option = ref false in |
| 44 | + let is_option_falsy = ref false in |
46 | 45 | let words = line |> String.split_on_char ' ' in
|
47 | 46 | words
|
48 | 47 | |> List.iter (fun word ->
|
49 | 48 | match word with
|
50 |
| - | "\"uncurried\"" | "\"uncurried\":" -> uncurried := true |
| 49 | + | "\"uncurried\"" | "\"uncurried\":" -> |
| 50 | + is_uncurried_option := true |
51 | 51 | | "\"uncurried\":false" | "\"uncurried\":false," ->
|
52 |
| - uncurried := true; |
53 |
| - false_ := true |
| 52 | + is_uncurried_option := true; |
| 53 | + is_option_falsy := true |
54 | 54 | | "false" | ":false" | "false," | ":false," ->
|
55 |
| - false_ := true |
| 55 | + is_option_falsy := true |
56 | 56 | | _ -> ());
|
57 |
| - not (!uncurried && !false_)) |
| 57 | + !is_uncurried_option && !is_option_falsy) |
58 | 58 | in
|
59 |
| - if uncurried then Config.uncurried := Uncurried |
| 59 | + if not is_legacy_uncurried then Config.uncurried := Uncurried |
60 | 60 |
|
61 | 61 | (* print res files to res syntax *)
|
62 | 62 | let printRes ~ignoreParseErrors ~isInterface ~filename =
|
|
0 commit comments