Skip to content

Commit 5e19ea8

Browse files
authored
Use ppxlib version 0.37 at least (#181)
1 parent 9ca2ed1 commit 5e19ea8

26 files changed

+939
-1100
lines changed

.github/workflows/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- 4
2121
include:
2222
- os: ubuntu-latest
23-
ocaml-compiler: "4.08"
23+
ocaml-compiler: "4.13"
2424

2525
runs-on: ${{ matrix.os }}
2626

dune-project

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
(synopsis "Runtime Library for gen_js_api generated libraries")
1919
(description "To be used in conjunction with gen_js_api")
2020
(depends
21-
(ocaml (>= 4.08))
21+
(ocaml (>= 4.13))
2222
(js_of_ocaml-compiler (>= 4.0.0)))
2323
)
2424

@@ -35,8 +35,8 @@ gen_js_api is to be used with the js_of_ocaml compiler.
3535
")
3636
(conflicts (js_of_ocaml-compiler (< 4.0.0)))
3737
(depends
38-
(ocaml (>= 4.08))
39-
(ppxlib (>= 0.26))
38+
(ocaml (>= 4.13))
39+
(ppxlib (>= 0.37))
4040
(js_of_ocaml-compiler :with-test)
4141
(ojs (= :version)))
4242
)

gen_js_api.opam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ homepage: "https://github.com/LexiFi/gen_js_api"
2121
bug-reports: "https://github.com/LexiFi/gen_js_api/issues"
2222
depends: [
2323
"dune" {>= "3.0"}
24-
"ocaml" {>= "4.08"}
25-
"ppxlib" {>= "0.26"}
24+
"ocaml" {>= "4.13"}
25+
"ppxlib" {>= "0.37"}
2626
"js_of_ocaml-compiler" {with-test}
2727
"ojs" {= version}
2828
"odoc" {with-doc}

node-test/bindings/expected/arrays.ml

Lines changed: 47 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,86 +3,74 @@
33
module JsArray(E:Ojs.T) =
44
struct
55
type t = Ojs.t
6-
let rec (t_of_js : Ojs.t -> t) = fun (x2 : Ojs.t) -> x2
7-
and (t_to_js : t -> Ojs.t) = fun (x1 : Ojs.t) -> x1
8-
let (create : unit -> t) =
6+
let rec t_of_js : Ojs.t -> t = fun (x2 : Ojs.t) -> x2
7+
and t_to_js : t -> Ojs.t = fun (x1 : Ojs.t) -> x1
8+
let create : unit -> t =
99
fun () ->
1010
t_of_js (Ojs.new_obj (Ojs.get_prop_ascii Ojs.global "Array") [||])
11-
let (push : t -> E.t -> unit) =
12-
fun (x4 : t) ->
13-
fun (x3 : E.t) ->
14-
ignore (Ojs.call (t_to_js x4) "push" [|(E.t_to_js x3)|])
15-
let (pop : t -> E.t option) =
11+
let push : t -> E.t -> unit =
12+
fun (x4 : t) (x3 : E.t) ->
13+
ignore (Ojs.call (t_to_js x4) "push" [|(E.t_to_js x3)|])
14+
let pop : t -> E.t option =
1615
fun (x5 : t) ->
1716
Ojs.option_of_js E.t_of_js (Ojs.call (t_to_js x5) "pop" [||])
1817
end
1918
module UntypedArray = struct include (JsArray)(Ojs) end
2019
module StringArray =
2120
struct
2221
include (JsArray)(Ojs.String)
23-
let (join : t -> string -> string) =
24-
fun (x8 : t) ->
25-
fun (x7 : string) ->
26-
Ojs.string_of_js
27-
(Ojs.call (t_to_js x8) "join" [|(Ojs.string_to_js x7)|])
22+
let join : t -> string -> string =
23+
fun (x8 : t) (x7 : string) ->
24+
Ojs.string_of_js
25+
(Ojs.call (t_to_js x8) "join" [|(Ojs.string_to_js x7)|])
2826
end
2927
module JsArray2 =
3028
struct
3129
type 'a t = Ojs.t
3230
let rec t_of_js : 'a . (Ojs.t -> 'a) -> Ojs.t -> 'a t =
33-
fun (type __a) ->
34-
fun (__a_of_js : Ojs.t -> __a) -> fun (x10 : Ojs.t) -> x10
31+
fun (type __a) (__a_of_js : Ojs.t -> __a) -> fun (x10 : Ojs.t) -> x10
3532
and t_to_js : 'a . ('a -> Ojs.t) -> 'a t -> Ojs.t =
36-
fun (type __a) ->
37-
fun (__a_to_js : __a -> Ojs.t) -> fun (x9 : Ojs.t) -> x9
38-
let (create : unit -> 'a t) =
33+
fun (type __a) (__a_to_js : __a -> Ojs.t) -> fun (x9 : Ojs.t) -> x9
34+
let create : unit -> 'a t =
3935
fun () ->
4036
t_of_js Obj.magic
4137
(Ojs.new_obj (Ojs.get_prop_ascii Ojs.global "Array") [||])
42-
let (create' : (module Ojs.T with type t = 'a) -> 'a list -> 'a t) =
38+
let create' : (module Ojs.T with type t = 'a) -> 'a list -> 'a t =
4339
fun (type a) ->
44-
fun ((module A) : (module Ojs.T with type t = a)) ->
45-
fun (x12 : a list) ->
46-
t_of_js A.t_of_js
47-
(Ojs.new_obj_arr (Ojs.get_prop_ascii Ojs.global "Array")
48-
(let x13 =
49-
Ojs.new_obj (Ojs.get_prop_ascii Ojs.global "Array") [||] in
50-
List.iter
51-
(fun (x14 : a) ->
52-
ignore (Ojs.call x13 "push" [|(A.t_to_js x14)|])) x12;
53-
x13))
54-
let (push : (module Ojs.T with type t = 'a) -> 'a t -> 'a -> unit) =
40+
fun ((module A) : (module Ojs.T with type t = a)) (x12 : a list) ->
41+
t_of_js A.t_of_js
42+
(Ojs.new_obj_arr (Ojs.get_prop_ascii Ojs.global "Array")
43+
(let x13 =
44+
Ojs.new_obj (Ojs.get_prop_ascii Ojs.global "Array") [||] in
45+
List.iter
46+
(fun (x14 : a) ->
47+
ignore (Ojs.call x13 "push" [|(A.t_to_js x14)|])) x12;
48+
x13))
49+
let push : (module Ojs.T with type t = 'a) -> 'a t -> 'a -> unit =
5550
fun (type a) ->
56-
fun ((module A) : (module Ojs.T with type t = a)) ->
57-
fun (x17 : a t) ->
58-
fun (x16 : a) ->
59-
ignore
60-
(Ojs.call (t_to_js A.t_to_js x17) "push" [|(A.t_to_js x16)|])
61-
let (pop : (module Ojs.T with type t = 'a) -> 'a t -> 'a option) =
51+
fun ((module A) : (module Ojs.T with type t = a)) (x17 : a t)
52+
(x16 : a) ->
53+
ignore
54+
(Ojs.call (t_to_js A.t_to_js x17) "push" [|(A.t_to_js x16)|])
55+
let pop : (module Ojs.T with type t = 'a) -> 'a t -> 'a option =
6256
fun (type a) ->
63-
fun ((module A) : (module Ojs.T with type t = a)) ->
64-
fun (x19 : a t) ->
65-
Ojs.option_of_js A.t_of_js
66-
(Ojs.call (t_to_js A.t_to_js x19) "pop" [||])
67-
let (get : (module Ojs.T with type t = 'a) -> 'a t -> int -> 'a option) =
57+
fun ((module A) : (module Ojs.T with type t = a)) (x19 : a t) ->
58+
Ojs.option_of_js A.t_of_js
59+
(Ojs.call (t_to_js A.t_to_js x19) "pop" [||])
60+
let get : (module Ojs.T with type t = 'a) -> 'a t -> int -> 'a option =
6861
fun (type a) ->
69-
fun ((module A) : (module Ojs.T with type t = a)) ->
70-
fun (x22 : a t) ->
71-
fun (x24 : int) ->
72-
Ojs.option_of_js A.t_of_js
73-
(Ojs.array_get (t_to_js A.t_to_js x22) x24)
74-
let (set : (module Ojs.T with type t = 'a) -> 'a t -> int -> 'a -> unit)
75-
=
62+
fun ((module A) : (module Ojs.T with type t = a)) (x22 : a t)
63+
(x24 : int) ->
64+
Ojs.option_of_js A.t_of_js
65+
(Ojs.array_get (t_to_js A.t_to_js x22) x24)
66+
let set : (module Ojs.T with type t = 'a) -> 'a t -> int -> 'a -> unit =
7667
fun (type a) ->
77-
fun ((module A) : (module Ojs.T with type t = a)) ->
78-
fun (x26 : a t) ->
79-
fun (x28 : int) ->
80-
fun (x29 : a) ->
81-
Ojs.array_set (t_to_js A.t_to_js x26) x28 (A.t_to_js x29)
82-
let (join : string t -> string -> string) =
83-
fun (x31 : string t) ->
84-
fun (x30 : string) ->
85-
Ojs.string_of_js
86-
(Ojs.call (t_to_js Ojs.string_to_js x31) "join"
87-
[|(Ojs.string_to_js x30)|])
68+
fun ((module A) : (module Ojs.T with type t = a)) (x26 : a t)
69+
(x28 : int) (x29 : a) ->
70+
Ojs.array_set (t_to_js A.t_to_js x26) x28 (A.t_to_js x29)
71+
let join : string t -> string -> string =
72+
fun (x31 : string t) (x30 : string) ->
73+
Ojs.string_of_js
74+
(Ojs.call (t_to_js Ojs.string_to_js x31) "join"
75+
[|(Ojs.string_to_js x30)|])
8876
end
Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,45 @@
11
[@@@js.dummy "!! This code has been generated by gen_js_api !!"]
22
[@@@ocaml.warning "-7-32-39"]
33
type t = Ojs.t
4-
let rec (t_of_js : Ojs.t -> t) = fun (x2 : Ojs.t) -> x2
5-
and (t_to_js : t -> Ojs.t) = fun (x1 : Ojs.t) -> x1
6-
let (alloc : int -> t) =
4+
let rec t_of_js : Ojs.t -> t = fun (x2 : Ojs.t) -> x2
5+
and t_to_js : t -> Ojs.t = fun (x1 : Ojs.t) -> x1
6+
let alloc : int -> t =
77
fun (x3 : int) ->
88
t_of_js
99
(Ojs.call (Ojs.get_prop_ascii Ojs.global "Buffer") "alloc"
1010
[|(Ojs.int_to_js x3)|])
11-
let (from : string -> t) =
11+
let from : string -> t =
1212
fun (x4 : string) ->
1313
t_of_js
1414
(Ojs.call (Ojs.get_prop_ascii Ojs.global "Buffer") "from"
1515
[|(Ojs.string_to_js x4)|])
16-
let (concat : t list -> t) =
16+
let concat : t list -> t =
1717
fun (x5 : t list) ->
1818
t_of_js
1919
(Ojs.call (Ojs.get_prop_ascii Ojs.global "Buffer") "concat"
2020
[|(Ojs.list_to_js t_to_js x5)|])
21-
let (length : t -> int) =
21+
let length : t -> int =
2222
fun (x7 : t) -> Ojs.int_of_js (Ojs.get_prop_ascii (t_to_js x7) "length")
23-
let (get : t -> int -> int option) =
24-
fun (x8 : t) ->
25-
fun (x9 : int) ->
26-
Ojs.option_of_js Ojs.int_of_js (Ojs.array_get (t_to_js x8) x9)
27-
let (set : t -> int -> int -> unit) =
28-
fun (x11 : t) ->
29-
fun (x12 : int) ->
30-
fun (x13 : int) -> Ojs.array_set (t_to_js x11) x12 (Ojs.int_to_js x13)
31-
let (write : t -> string -> int) =
32-
fun (x15 : t) ->
33-
fun (x14 : string) ->
34-
Ojs.int_of_js
35-
(Ojs.call (t_to_js x15) "write" [|(Ojs.string_to_js x14)|])
36-
let (slice : t -> int -> int -> t) =
37-
fun (x18 : t) ->
38-
fun (x16 : int) ->
39-
fun (x17 : int) ->
40-
t_of_js
41-
(Ojs.call (t_to_js x18) "slice"
42-
[|(Ojs.int_to_js x16);(Ojs.int_to_js x17)|])
43-
let (to_string : t -> string) =
23+
let get : t -> int -> int option =
24+
fun (x8 : t) (x9 : int) ->
25+
Ojs.option_of_js Ojs.int_of_js (Ojs.array_get (t_to_js x8) x9)
26+
let set : t -> int -> int -> unit =
27+
fun (x11 : t) (x12 : int) (x13 : int) ->
28+
Ojs.array_set (t_to_js x11) x12 (Ojs.int_to_js x13)
29+
let write : t -> string -> int =
30+
fun (x15 : t) (x14 : string) ->
31+
Ojs.int_of_js (Ojs.call (t_to_js x15) "write" [|(Ojs.string_to_js x14)|])
32+
let slice : t -> int -> int -> t =
33+
fun (x18 : t) (x16 : int) (x17 : int) ->
34+
t_of_js
35+
(Ojs.call (t_to_js x18) "slice"
36+
[|(Ojs.int_to_js x16);(Ojs.int_to_js x17)|])
37+
let to_string : t -> string =
4438
fun (x19 : t) -> Ojs.string_of_js (Ojs.call (t_to_js x19) "toString" [||])
45-
let (copy : t -> dst:t -> start:int -> dst_start:int -> dst_end:int -> int) =
46-
fun (x24 : t) ->
47-
fun ~dst:(x20 : t) ->
48-
fun ~start:(x21 : int) ->
49-
fun ~dst_start:(x22 : int) ->
50-
fun ~dst_end:(x23 : int) ->
51-
Ojs.int_of_js
52-
(Ojs.call (t_to_js x24) "copy"
53-
[|(t_to_js x20);(Ojs.int_to_js x21);(Ojs.int_to_js x22);(
54-
Ojs.int_to_js x23)|])
39+
let copy : t -> dst:t -> start:int -> dst_start:int -> dst_end:int -> int =
40+
fun (x24 : t) ~dst:(x20 : t) ~start:(x21 : int) ~dst_start:(x22 : int)
41+
~dst_end:(x23 : int) ->
42+
Ojs.int_of_js
43+
(Ojs.call (t_to_js x24) "copy"
44+
[|(t_to_js x20);(Ojs.int_to_js x21);(Ojs.int_to_js x22);(Ojs.int_to_js
45+
x23)|])
Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
[@@@js.dummy "!! This code has been generated by gen_js_api !!"]
22
[@@@ocaml.warning "-7-32-39"]
3-
let (log : 'a -> unit) =
3+
let log : 'a -> unit =
44
fun (x1 : 'a) ->
55
ignore
66
(Ojs.call (Ojs.get_prop_ascii Ojs.global "console") "log"
77
[|(Obj.magic x1)|])
8-
let (error : 'a -> unit) =
8+
let error : 'a -> unit =
99
fun (x2 : 'a) ->
1010
ignore
1111
(Ojs.call (Ojs.get_prop_ascii Ojs.global "console") "error"
1212
[|(Obj.magic x2)|])
1313
module T =
1414
struct
15-
let (log : (module Ojs.T with type t = 'a) -> 'a -> unit) =
15+
let log : (module Ojs.T with type t = 'a) -> 'a -> unit =
1616
fun (type a) ->
17-
fun ((module A) : (module Ojs.T with type t = a)) ->
18-
fun (x3 : a) ->
19-
ignore
20-
(Ojs.call (Ojs.get_prop_ascii Ojs.global "console") "log"
21-
[|(A.t_to_js x3)|])
22-
let (error : (module Ojs.T with type t = 'a) -> 'a -> unit) =
17+
fun ((module A) : (module Ojs.T with type t = a)) (x3 : a) ->
18+
ignore
19+
(Ojs.call (Ojs.get_prop_ascii Ojs.global "console") "log"
20+
[|(A.t_to_js x3)|])
21+
let error : (module Ojs.T with type t = 'a) -> 'a -> unit =
2322
fun (type a) ->
24-
fun ((module A) : (module Ojs.T with type t = a)) ->
25-
fun (x4 : a) ->
26-
ignore
27-
(Ojs.call (Ojs.get_prop_ascii Ojs.global "console") "error"
28-
[|(A.t_to_js x4)|])
23+
fun ((module A) : (module Ojs.T with type t = a)) (x4 : a) ->
24+
ignore
25+
(Ojs.call (Ojs.get_prop_ascii Ojs.global "console") "error"
26+
[|(A.t_to_js x4)|])
2927
end

node-test/bindings/expected/errors.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
module Error =
44
struct
55
type t = Ojs.t
6-
let rec (t_of_js : Ojs.t -> t) = fun (x2 : Ojs.t) -> x2
7-
and (t_to_js : t -> Ojs.t) = fun (x1 : Ojs.t) -> x1
8-
let (create : string -> t) =
6+
let rec t_of_js : Ojs.t -> t = fun (x2 : Ojs.t) -> x2
7+
and t_to_js : t -> Ojs.t = fun (x1 : Ojs.t) -> x1
8+
let create : string -> t =
99
fun (x3 : string) ->
1010
t_of_js
1111
(Ojs.new_obj (Ojs.get_prop_ascii Ojs.global "Error")
1212
[|(Ojs.string_to_js x3)|])
13-
let (stack_trace_limit : int) =
13+
let stack_trace_limit : int =
1414
Ojs.int_of_js
1515
(Ojs.get_prop_ascii (Ojs.get_prop_ascii Ojs.global "Error")
1616
"stackTraceLimit")
17-
let (set_stack_trace_limit : int -> unit) =
17+
let set_stack_trace_limit : int -> unit =
1818
fun (x4 : int) ->
1919
Ojs.set_prop_ascii (Ojs.get_prop_ascii Ojs.global "Error")
2020
"stackTraceLimit" (Ojs.int_to_js x4)
21-
let (code : t -> string) =
21+
let code : t -> string =
2222
fun (x5 : t) ->
2323
Ojs.string_of_js (Ojs.get_prop_ascii (t_to_js x5) "code")
24-
let (message : t -> string) =
24+
let message : t -> string =
2525
fun (x6 : t) ->
2626
Ojs.string_of_js (Ojs.get_prop_ascii (t_to_js x6) "message")
27-
let (stack : t -> string) =
27+
let stack : t -> string =
2828
fun (x7 : t) ->
2929
Ojs.string_of_js (Ojs.get_prop_ascii (t_to_js x7) "stack")
3030
end

0 commit comments

Comments
 (0)