Skip to content

Commit d903dfc

Browse files
author
Nathan Rebours
committed
Redefine longident migration explicitly
Using the one from the Migrate_x modules lead to circular dependencies Signed-off-by: Nathan Rebours <[email protected]>
1 parent c22cdf1 commit d903dfc

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

astlib/longident.ml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,27 @@ let parse s =
3030
so as not to crash the toplevel (see Genprintval) *)
3131
| Some v -> v
3232

33+
let rec to_504_plus lid =
34+
let loc = Location.none in
35+
match lid with
36+
| Lident s -> Longident_504.Lident s
37+
| Ldot (lid, s) ->
38+
Longident_504.Ldot ({txt = to_504_plus lid; loc}, { txt = s; loc})
39+
| Lapply (lid, lid2) ->
40+
Longident_504.Lapply
41+
({txt = to_504_plus lid; loc}, {txt= to_504_plus lid2; loc})
42+
43+
let rec from_504_plus lid =
44+
match lid with
45+
| Longident_504.Lident s -> Lident s
46+
| Longident_504.Ldot (lid, s) -> Ldot (from_504_plus lid.txt, s.txt)
47+
| Longident_504.Lapply (lid, lid2) ->
48+
Lapply (from_504_plus lid.txt, from_504_plus lid2.txt)
49+
3350
let to_compiler lid =
3451
(*IF_NOT_AT_LEAST 504 lid *)
35-
(*IF_AT_LEAST 504 Migrate_503_504.copy_Longident_t lid *)
52+
(*IF_AT_LEAST 504 to_504_plus lid *)
3653

3754
let from_compiler lid =
3855
(*IF_NOT_AT_LEAST 504 lid *)
39-
(*IF_AT_LEAST 504 Migrate_504_503.copy_Longident_t lid *)
56+
(*IF_AT_LEAST 504 from_504_plus lid *)

0 commit comments

Comments
 (0)