Skip to content

Commit 13ecd6b

Browse files
authored
Fix objintf jsoo (#429)
* update objintf examples * fix jsoo_full_bridge.ml * generate code * update test
1 parent cd89950 commit 13ecd6b

16 files changed

+163
-147
lines changed

example/for_dev/objintf_examples/lib_objintf_gen/ex_objintf_one_directional_gen.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ module Simple_interfaces = struct
130130
end
131131

132132
module type with_default_value = sig
133-
val get_default_string : ?str:string -> string
134-
val get_default_student : ?student:ex_record_student -> string
133+
val get_default_string : ?larg_str:string -> string
134+
val get_default_student : ?larg_student:ex_record_student -> string
135135
end
136136
end
137137

@@ -173,8 +173,8 @@ module type Concrete_bridge = sig
173173
open Interfaces [@@warning "-33"]
174174

175175
module Peer_object_registry : sig
176-
val lookup_string : id0:string -> id1:Kxclib.int53p -> string option
177-
val lookup_hello : id:string -> hello peer option
176+
val lookup_string : cdn_id0:string -> cdn_id1:Kxclib.int53p -> string option
177+
val lookup_hello : cdn_id:string -> hello peer option
178178
end
179179

180180
module Peer_objects : sig

example/for_dev/objintf_examples/lib_objintf_gen/ex_objintf_one_directional_gen.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ module Simple_interfaces : sig
3333
end
3434

3535
module type with_default_value = sig
36-
val get_default_string : ?str:string -> string
37-
val get_default_student : ?student:ex_record_student -> string
36+
val get_default_string : ?larg_str:string -> string
37+
val get_default_student : ?larg_student:ex_record_student -> string
3838
end
3939
end
4040

@@ -76,8 +76,8 @@ module type Concrete_bridge = sig
7676
open Interfaces [@@warning "-33"]
7777

7878
module Peer_object_registry : sig
79-
val lookup_string : id0:string -> id1:Kxclib.int53p -> string option
80-
val lookup_hello : id:string -> hello peer option
79+
val lookup_string : cdn_id0:string -> cdn_id1:Kxclib.int53p -> string option
80+
val lookup_hello : cdn_id:string -> hello peer option
8181
end
8282

8383
module Peer_objects : sig

example/for_dev/objintf_examples/lib_objintf_gen/ex_objintf_one_directional_trans_gen.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,18 @@ module Simple_interfaces = struct
130130
end
131131

132132
module type with_default_value = sig
133-
val get_default_string : ?str:string -> string
134-
val get_default_student : ?student:ex_record_student -> string
133+
val get_default_string : ?larg_str:string -> string
134+
val get_default_student : ?larg_student:ex_record_student -> string
135135
end
136136
end
137137

138138
open Simple_interfaces [@@warning "-33"]
139139

140140
module type Endemic_object_registry_interface = sig
141-
val register_string : id0:string -> id1:Kxclib.int53p -> string option -> unit
142-
val register_hello : id:string -> hello option -> unit
141+
val register_string :
142+
cdn_id0:string -> cdn_id1:Kxclib.int53p -> string option -> unit
143+
144+
val register_hello : cdn_id:string -> hello option -> unit
143145
end
144146

145147
module Concrete_bridge_interfaces = struct

example/for_dev/objintf_examples/lib_objintf_gen/ex_objintf_one_directional_trans_gen.mli

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ module Simple_interfaces : sig
3333
end
3434

3535
module type with_default_value = sig
36-
val get_default_string : ?str:string -> string
37-
val get_default_student : ?student:ex_record_student -> string
36+
val get_default_string : ?larg_str:string -> string
37+
val get_default_student : ?larg_student:ex_record_student -> string
3838
end
3939
end
4040

4141
open Simple_interfaces [@@warning "-33"]
4242

4343
module type Endemic_object_registry_interface = sig
44-
val register_string : id0:string -> id1:Kxclib.int53p -> string option -> unit
45-
val register_hello : id:string -> hello option -> unit
44+
val register_string :
45+
cdn_id0:string -> cdn_id1:Kxclib.int53p -> string option -> unit
46+
47+
val register_hello : cdn_id:string -> hello option -> unit
4648
end
4749

4850
module Concrete_bridge_interfaces : sig

example/for_dev/objintf_examples/lib_objintf_gen_jsoo/ex_objintf_one_directional_jsoo_gen.ml

Lines changed: 56 additions & 50 deletions
Large diffs are not rendered by default.

example/for_dev/objintf_examples/lib_objintf_gen_jsoo/ex_objintf_one_directional_jsoo_gen.mli

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ module Simple_interfaces : sig
3333
end
3434

3535
module type with_default_value = sig
36-
val get_default_string : ?str:string -> string
37-
val get_default_student : ?student:ex_record_student -> string
36+
val get_default_string : ?larg_str:string -> string
37+
val get_default_student : ?larg_student:ex_record_student -> string
3838
end
3939
end
4040

@@ -76,8 +76,8 @@ module type Concrete_bridge = sig
7676
open Interfaces [@@warning "-33"]
7777

7878
module Peer_object_registry : sig
79-
val lookup_string : id0:string -> id1:Kxclib.int53p -> string option
80-
val lookup_hello : id:string -> hello peer option
79+
val lookup_string : cdn_id0:string -> cdn_id1:Kxclib.int53p -> string option
80+
val lookup_hello : cdn_id:string -> hello peer option
8181
end
8282

8383
module Peer_objects : sig

example/for_dev/objintf_examples/lib_objintf_gen_jsoo/ex_objintf_one_directional_jsoo_trans_gen.ml

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,18 @@ module Simple_interfaces = struct
130130
end
131131

132132
module type with_default_value = sig
133-
val get_default_string : ?str:string -> string
134-
val get_default_student : ?student:ex_record_student -> string
133+
val get_default_string : ?larg_str:string -> string
134+
val get_default_student : ?larg_student:ex_record_student -> string
135135
end
136136
end
137137

138138
open Simple_interfaces [@@warning "-33"]
139139

140140
module type Endemic_object_registry_interface = sig
141-
val register_string : id0:string -> id1:Kxclib.int53p -> string option -> unit
142-
val register_hello : id:string -> hello option -> unit
141+
val register_string :
142+
cdn_id0:string -> cdn_id1:Kxclib.int53p -> string option -> unit
143+
144+
val register_hello : cdn_id:string -> hello option -> unit
143145
end
144146

145147
module Concrete_bridge_interfaces = struct
@@ -237,8 +239,8 @@ functor
237239
and decode_int53p_of_js = Kxclib.Int53p.of_float [@@warning "-32"]
238240

239241
let rec encode_hello_to_js (__caml_obj : hello) =
240-
Js_of_ocaml.Js.Unsafe.callback (fun name ->
241-
encode_unit_to_js (__caml_obj (decode_string_of_js name)))
242+
Js_of_ocaml.Js.Unsafe.callback (fun parg_name ->
243+
encode_unit_to_js (__caml_obj (decode_string_of_js parg_name)))
242244
[@@warning "-39"]
243245

244246
and encode_unit_sole_to_js (__caml_obj : unit_sole) =
@@ -261,9 +263,9 @@ functor
261263
(__caml_obj#unit_01 (decode_string_of_js __arg0) ()))) );
262264
( "unit02",
263265
Unsafe.inject
264-
(Unsafe.callback (fun __arg0 ->
266+
(Unsafe.callback (fun parg_name ->
265267
encode_string_to_js
266-
(__caml_obj#unit_02 (decode_string_of_js __arg0) () ())))
268+
(__caml_obj#unit_02 (decode_string_of_js parg_name) () ())))
267269
);
268270
( "unit03",
269271
Unsafe.inject
@@ -288,9 +290,9 @@ functor
288290
(M.unit_01 (decode_string_of_js __arg0) ()))) );
289291
( "unit02",
290292
Unsafe.inject
291-
(Unsafe.callback (fun __arg0 ->
293+
(Unsafe.callback (fun parg_name ->
292294
encode_string_to_js
293-
(M.unit_02 (decode_string_of_js __arg0) () ()))) );
295+
(M.unit_02 (decode_string_of_js parg_name) () ()))) );
294296
( "unit03",
295297
Unsafe.inject
296298
(Unsafe.callback (fun __arg0 ->
@@ -308,10 +310,10 @@ functor
308310
(Unsafe.callback (fun labeledArgs ->
309311
encode_string_to_js
310312
(M.get_default_string
311-
~str:
313+
~larg_str:
312314
((let open Js_of_ocaml.Js in
313315
Optdef.bind labeledArgs (fun la ->
314-
Optdef.map (Unsafe.get la "str")
316+
Optdef.map (Unsafe.get la "largStr")
315317
decode_string_of_js)
316318
|> Optdef.to_option)
317319
|> Option.value ~default:"Hello")))) );
@@ -320,10 +322,11 @@ functor
320322
(Unsafe.callback (fun labeledArgs ->
321323
encode_string_to_js
322324
(M.get_default_student
323-
~student:
325+
~larg_student:
324326
((let open Js_of_ocaml.Js in
325327
Optdef.bind labeledArgs (fun la ->
326-
Optdef.map (Unsafe.get la "student") (fun x ->
328+
Optdef.map (Unsafe.get la "largStudent")
329+
(fun x ->
327330
Kxclib_js.Json_ext.of_xjv x
328331
|> ex_record_student_of_json'
329332
|> function
@@ -369,42 +372,42 @@ functor
369372

370373
let registry_of_string = ref StringMap.empty
371374

372-
let lookup_string ~id0 ~id1 =
375+
let lookup_string ~cdn_id0 ~cdn_id1 =
373376
!registry_of_string
374377
|> StringMap.find_opt
375378
(let open Map_key in
376379
String.concat ""
377380
[
378-
encode_map_key ~check_type:`string (Mk_string id0);
379-
encode_map_key ~check_type:`int53p (Mk_int53 id1);
381+
encode_map_key ~check_type:`string (Mk_string cdn_id0);
382+
encode_map_key ~check_type:`int53p (Mk_int53 cdn_id1);
380383
])
381384

382-
and register_string ~id0 ~id1 value =
385+
and register_string ~cdn_id0 ~cdn_id1 value =
383386
registry_of_string :=
384387
!registry_of_string
385388
|> StringMap.update
386389
(let open Map_key in
387390
String.concat ""
388391
[
389-
encode_map_key ~check_type:`string (Mk_string id0);
390-
encode_map_key ~check_type:`int53p (Mk_int53 id1);
392+
encode_map_key ~check_type:`string (Mk_string cdn_id0);
393+
encode_map_key ~check_type:`int53p (Mk_int53 cdn_id1);
391394
])
392395
(fun _ -> value)
393396

394397
let registry_of_hello = ref StringMap.empty
395398

396-
let lookup_hello ~id =
399+
let lookup_hello ~cdn_id =
397400
!registry_of_hello
398401
|> StringMap.find_opt
399402
(let open Map_key in
400-
encode_map_key ~check_type:`string (Mk_string id))
403+
encode_map_key ~check_type:`string (Mk_string cdn_id))
401404

402-
and register_hello ~id value =
405+
and register_hello ~cdn_id value =
403406
registry_of_hello :=
404407
!registry_of_hello
405408
|> StringMap.update
406409
(let open Map_key in
407-
encode_map_key ~check_type:`string (Mk_string id))
410+
encode_map_key ~check_type:`string (Mk_string cdn_id))
408411
(fun _ -> value)
409412
end
410413

@@ -438,12 +441,12 @@ functor
438441
Unsafe.inject
439442
(Unsafe.callback (fun coordinate ->
440443
lookup_string
441-
~id0:
444+
~cdn_id0:
442445
(decode_string_of_js
443-
(Js.Unsafe.get coordinate "id0"))
444-
~id1:
446+
(Js.Unsafe.get coordinate "cdnId0"))
447+
~cdn_id1:
445448
(decode_int53p_of_js
446-
(Js.Unsafe.get coordinate "id1"))
449+
(Js.Unsafe.get coordinate "cdnId1"))
447450
|> function
448451
| None -> Js.Unsafe.inject Js.null
449452
| Some obj ->
@@ -453,9 +456,9 @@ functor
453456
Unsafe.inject
454457
(Unsafe.callback (fun coordinate ->
455458
lookup_hello
456-
~id:
459+
~cdn_id:
457460
(decode_string_of_js
458-
(Js.Unsafe.get coordinate "id"))
461+
(Js.Unsafe.get coordinate "cdnId"))
459462
|> function
460463
| None -> Js.Unsafe.inject Js.null
461464
| Some obj ->

example/for_dev/objintf_examples/lib_objintf_gen_jsoo/ex_objintf_one_directional_jsoo_trans_gen.mli

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ module Simple_interfaces : sig
3333
end
3434

3535
module type with_default_value = sig
36-
val get_default_string : ?str:string -> string
37-
val get_default_student : ?student:ex_record_student -> string
36+
val get_default_string : ?larg_str:string -> string
37+
val get_default_student : ?larg_student:ex_record_student -> string
3838
end
3939
end
4040

4141
open Simple_interfaces [@@warning "-33"]
4242

4343
module type Endemic_object_registry_interface = sig
44-
val register_string : id0:string -> id1:Kxclib.int53p -> string option -> unit
45-
val register_hello : id:string -> hello option -> unit
44+
val register_string :
45+
cdn_id0:string -> cdn_id1:Kxclib.int53p -> string option -> unit
46+
47+
val register_hello : cdn_id:string -> hello option -> unit
4648
end
4749

4850
module Concrete_bridge_interfaces : sig

example/for_dev/objintf_examples/lib_objintf_gen_ts/ex_objintf_one_directional_gen.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ import { objintf as bindoj } from "../../public-packages/runtime";
33
import { NonJsonValues } from "./utils";
44
export type MyString = string;
55
export type ExRecordStudent = { readonly admissionYear: number; readonly name: string };
6-
export type Hello = (name: string) => void;
6+
export type Hello = (pargName: string) => void;
77
export type UnitSole = (__arg0: string) => string;
88
export type UnitObj = {
99
readonly name: () => string;
1010
readonly unit01: (__arg0: string) => string;
11-
readonly unit02: (__arg0: string) => string;
11+
readonly unit02: (pargName: string) => string;
1212
readonly unit03: (__arg0: string) => string;
1313
};
1414
export type UnitMod = {
1515
readonly name: () => string;
1616
readonly unit01: (__arg0: string) => string;
17-
readonly unit02: (__arg0: string) => string;
17+
readonly unit02: (pargName: string) => string;
1818
readonly unit03: (__arg0: string) => string;
1919
};
2020
export type WithDefaultValue = {
21-
readonly getDefaultString: (labeledArgs?: { readonly str?: MyString }) => string;
22-
readonly getDefaultStudent: (labeledArgs?: { readonly student?: ExRecordStudent }) => string;
21+
readonly getDefaultString: (labeledArgs?: { readonly largStr?: MyString }) => string;
22+
readonly getDefaultStudent: (labeledArgs?: { readonly largStudent?: ExRecordStudent }) => string;
2323
};
2424
export namespace GeneratedBridge {
2525
export type PeerFullBridgeReference = bindoj.PeerFullBridgeReference<ConcreteBridge>;
@@ -29,8 +29,8 @@ export namespace GeneratedBridge {
2929
}
3030
export type ConcreteBridge = {
3131
readonly peerObjectRegistry: {
32-
readonly lookupString: (coordinate: { readonly id0: string; readonly id1: number }) => string | null;
33-
readonly lookupHello: (coordinate: { readonly id: string }) => bindoj.peer<Hello> | null;
32+
readonly lookupString: (coordinate: { readonly cdnId0: string; readonly cdnId1: number }) => string | null;
33+
readonly lookupHello: (coordinate: { readonly cdnId: string }) => bindoj.peer<Hello> | null;
3434
};
3535
readonly peerObjects: {
3636
readonly myString: string;

example/for_dev/objintf_examples/lib_objintf_gen_ts/ex_objintf_one_directional_trans_gen.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ import { objintf as bindoj } from "../../public-packages/runtime";
33
import { NonJsonValues } from "./utils";
44
export type MyString = string;
55
export type ExRecordStudent = { readonly admissionYear: number; readonly name: string };
6-
export type Hello = (name: string) => void;
6+
export type Hello = (pargName: string) => void;
77
export type UnitSole = (__arg0: string) => string;
88
export type UnitObj = {
99
readonly name: () => string;
1010
readonly unit01: (__arg0: string) => string;
11-
readonly unit02: (__arg0: string) => string;
11+
readonly unit02: (pargName: string) => string;
1212
readonly unit03: (__arg0: string) => string;
1313
};
1414
export type UnitMod = {
1515
readonly name: () => string;
1616
readonly unit01: (__arg0: string) => string;
17-
readonly unit02: (__arg0: string) => string;
17+
readonly unit02: (pargName: string) => string;
1818
readonly unit03: (__arg0: string) => string;
1919
};
2020
export type WithDefaultValue = {
21-
readonly getDefaultString: (labeledArgs?: { readonly str?: MyString }) => string;
22-
readonly getDefaultStudent: (labeledArgs?: { readonly student?: ExRecordStudent }) => string;
21+
readonly getDefaultString: (labeledArgs?: { readonly largStr?: MyString }) => string;
22+
readonly getDefaultStudent: (labeledArgs?: { readonly largStudent?: ExRecordStudent }) => string;
2323
};
2424
export namespace GeneratedBridge {
2525
export type PeerFullBridgeReference = bindoj.PeerFullBridgeReference<ConcreteBridge>;
@@ -29,8 +29,8 @@ export namespace GeneratedBridge {
2929
}
3030
export type EndemicSetupParams = {
3131
readonly initiallyRegisteredObjects: {
32-
readonly string: [{ readonly id0: string; readonly id1: number }, string][];
33-
readonly hello: [{ readonly id: string }, Hello][];
32+
readonly string: [{ readonly cdnId0: string; readonly cdnId1: number }, string][];
33+
readonly hello: [{ readonly cdnId: string }, Hello][];
3434
};
3535
readonly endemicObjects: {
3636
readonly myString: string;
@@ -47,12 +47,12 @@ export namespace GeneratedBridge {
4747
export type ConcreteBridge = {
4848
readonly endemicObjectRegistry: {
4949
readonly string: {
50-
readonly register: (coordinate: { readonly id0: string; readonly id1: number }, obj: string) => void;
51-
readonly deregister: (coordinate: { readonly id0: string; readonly id1: number }) => void;
50+
readonly register: (coordinate: { readonly cdnId0: string; readonly cdnId1: number }, obj: string) => void;
51+
readonly deregister: (coordinate: { readonly cdnId0: string; readonly cdnId1: number }) => void;
5252
};
5353
readonly hello: {
54-
readonly register: (coordinate: { readonly id: string }, obj: bindoj.endemic<Hello>) => void;
55-
readonly deregister: (coordinate: { readonly id: string }) => void;
54+
readonly register: (coordinate: { readonly cdnId: string }, obj: bindoj.endemic<Hello>) => void;
55+
readonly deregister: (coordinate: { readonly cdnId: string }) => void;
5656
};
5757
};
5858
};

0 commit comments

Comments
 (0)