Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for OCaml 4.08 #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/ppx_include.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#define Pconst_string Const_string
#endif

#if OCAML_VERSION >= (4, 08, 0)
#define Get_load_path Load_path.get_paths ()
#else
#define Get_load_path !Config.load_path
#endif

open Longident
open Asttypes
open Parsetree
Expand All @@ -10,7 +16,11 @@ open Ast_helper

let raise_errorf ?sub ?if_highlight ?loc message =
message |> Printf.kprintf (fun str ->
#if OCAML_VERSION >= (4, 08, 0)
let err = Location.error ?sub ?loc str in
#else
let err = Location.error ?sub ?if_highlight ?loc str in
#endif
raise (Location.Error err))

let filename_of_payload ~loc payload =
Expand All @@ -24,7 +34,7 @@ let filename_of_payload ~loc payload =
let lexbuf_of_payload ~loc payload =
let filename = filename_of_payload ~loc payload in
let load_paths =
(Filename.dirname loc.Location.loc_start.Lexing.pos_fname :: !Config.load_path) |>
(Filename.dirname loc.Location.loc_start.Lexing.pos_fname :: Get_load_path) |>
List.map (fun dir -> Filename.concat dir filename)
in
try
Expand Down