Fix build on 4.12
On 4.12, `Typemod.type_structure` does not take a location argument anymore (see ocaml/ocaml#9974). This fixes the build with the 4.12 branch.
This commit is contained in:
parent
7bc5117d34
commit
e31656e725
|
@ -589,15 +589,21 @@ let rewrite_str_item pstr_item tstr_item =
|
||||||
| _ ->
|
| _ ->
|
||||||
pstr_item
|
pstr_item
|
||||||
|
|
||||||
|
let type_structure env pstr =
|
||||||
|
#if OCAML_VERSION >= (4, 12, 0)
|
||||||
|
let tstr, _, _, _ = Typemod.type_structure env pstr in
|
||||||
|
#elif OCAML_VERSION >= (4, 08, 0)
|
||||||
|
let tstr, _, _, _ = Typemod.type_structure env pstr Location.none in
|
||||||
|
#else
|
||||||
|
let tstr, _, _ = Typemod.type_structure env pstr Location.none in
|
||||||
|
#endif
|
||||||
|
tstr
|
||||||
|
|
||||||
let rewrite phrase =
|
let rewrite phrase =
|
||||||
match phrase with
|
match phrase with
|
||||||
| Parsetree.Ptop_def pstr ->
|
| Parsetree.Ptop_def pstr ->
|
||||||
if (UTop.get_auto_run_lwt () || UTop.get_auto_run_async ()) && List.exists is_eval pstr then
|
if (UTop.get_auto_run_lwt () || UTop.get_auto_run_async ()) && List.exists is_eval pstr then
|
||||||
#if OCAML_VERSION >= (4, 08, 0)
|
let tstr = type_structure !Toploop.toplevel_env pstr in
|
||||||
let tstr, _, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr Location.none in
|
|
||||||
#else
|
|
||||||
let tstr, _, _ = Typemod.type_structure !Toploop.toplevel_env pstr Location.none in
|
|
||||||
#endif
|
|
||||||
Parsetree.Ptop_def (List.map2 rewrite_str_item pstr tstr.Typedtree.str_items)
|
Parsetree.Ptop_def (List.map2 rewrite_str_item pstr tstr.Typedtree.str_items)
|
||||||
else
|
else
|
||||||
phrase
|
phrase
|
||||||
|
|
Loading…
Reference in New Issue