Skip to content

Commit 771c82f

Browse files
authored
Merge pull request #659 from bloomberg/mutable_object
remove global config of bs class type and auto uncurry for less magic
2 parents 6dae93f + 18eb14d commit 771c82f

22 files changed

+294
-277
lines changed

jscomp/syntax/ppx_entry.ml

Lines changed: 184 additions & 201 deletions
Large diffs are not rendered by default.

jscomp/test/.depend

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ mt.cmj : ../stdlib/list.cmi ../others/bs_node.cmi ../stdlib/array.cmi mt.cmi
405405
mt.cmx : ../stdlib/list.cmx ../others/bs_node.cmi ../stdlib/array.cmx mt.cmi
406406
mt_global.cmj : mt.cmi mt_global.cmi
407407
mt_global.cmx : mt.cmx mt_global.cmi
408+
mutable_obj_test.cmj : ../runtime/js.cmj
409+
mutable_obj_test.cmx : ../runtime/js.cmx
408410
mutual_non_recursive_type.cmj :
409411
mutual_non_recursive_type.cmx :
410412
nested_include.cmj :
@@ -1175,6 +1177,8 @@ mt.cmo : ../stdlib/list.cmi ../others/bs_node.cmi ../stdlib/array.cmi mt.cmi
11751177
mt.cmj : ../stdlib/list.cmj ../others/bs_node.cmi ../stdlib/array.cmj mt.cmi
11761178
mt_global.cmo : mt.cmi mt_global.cmi
11771179
mt_global.cmj : mt.cmj mt_global.cmi
1180+
mutable_obj_test.cmo : ../runtime/js.cmo
1181+
mutable_obj_test.cmj : ../runtime/js.cmj
11781182
mutual_non_recursive_type.cmo :
11791183
mutual_non_recursive_type.cmj :
11801184
nested_include.cmo :

jscomp/test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ OTHERS := literals a test_ari test_export2 test_internalOO test_obj_simple_ffi t
6060
bs_rest_test infer_type_test fs_test module_as_function\
6161
test_case_set test_mutliple string_bound_get_test inline_string_test\
6262
ppx_this_obj_test unsafe_obj_external gpr_627_test jsoo_485_test jsoo_400_test \
63-
test_require more_uncurry earger_curry_test poly_type bench
63+
test_require more_uncurry earger_curry_test poly_type bench mutable_obj_test
6464

6565

6666

jscomp/test/class_setter_getter.ml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11

2-
[@@@bs.config{bs_class_type}]
2+
33

44
class type _y = object
55
method height : int [@@bs.set {no_get}]
6-
end
6+
end [@bs]
77
type y = _y Js.t
88
class type _y0 = object
99
method height : int [@@bs.set] [@@bs.get {null}]
10-
end
10+
end [@bs]
1111
type y0 = _y0 Js.t
1212

1313
class type _y1 = object
1414
method height : int [@@bs.set] [@@bs.get {undefined}]
15-
end
15+
end[@bs]
1616
type y1 = _y1 Js.t
1717

1818
class type _y2 = object
1919
method height : int [@@bs.set] [@@bs.get {undefined; null}]
20-
end
20+
end [@bs]
2121
type y2 = _y2 Js.t
2222

2323
class type _y3 = object
2424
method height : int [@@bs.get {undefined ; null}]
25-
end
25+
end[@bs]
2626
type y3 = _y3 Js.t
2727

jscomp/test/class_type_ffi_test.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
[@@@bs.config{bs_class_type }]
1+
22
class type ['k,'v] arrayLike =
33
object
44
method case : 'k -> 'v Js.Null.t
55
method caseSet : 'k * 'v -> unit
66
method case_unsafe : 'k -> 'v
77
method length : int
8-
end
8+
end[@bs]
99

1010
class type floatArray = [int, float] arrayLike
11-
11+
(** here we can see [@bs] is really attached to `object end` instead of `class type` *)
1212
class type intArray = [int, int] arrayLike
1313

1414

jscomp/test/config1_test.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
;;[@@@bs.config{
3-
obj_type_auto_uncurry ;
3+
44
no_export ;
55
}]
66
;;

jscomp/test/config2_test.ml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
[@@@bs.config{
2-
obj_type_auto_uncurry ;
3-
bs_class_type
4-
(* no_export = true; *)
5-
}]
1+
62

73

84

95
class type v = object
106
method hey : int -> int -> int
11-
end
7+
end [@bs]
128

139
class type v2 = object
1410
method hey : int -> int -> int
15-
end
11+
end [@bs]
1612

1713
type vv =
1814
[%bs.obj: <
19-
hey : int -> int -> int
20-
> [@bs] ]
15+
hey : int -> int -> int [@bs]
16+
> ]
2117

2218
type vv2 =
2319
[%bs.obj: <
24-
hey : int -> int -> int
20+
hey : int -> int -> int [@bs]
2521
> ]
2622

2723

jscomp/test/config2_test.mli

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
1-
[@@@bs.config {obj_type_auto_uncurry ; (* no_export = true *)
2-
bs_class_type
3-
} ]
41

52

63
class type v = object
74
method hey : int -> int -> int
8-
end
5+
end [@bs]
96

107
class type v2 = object
118
method hey : int -> int -> int
12-
end
9+
end [@bs]
1310

1411
type vv =
1512
[%bs.obj: <
16-
hey : int -> int -> int
17-
> [@bs]]
13+
hey : int -> int -> int [@bs]
14+
> ]
1815

1916
type vv2 =
2017
[%bs.obj: <
21-
hey : int -> int -> int
18+
hey : int -> int -> int [@bs]
2219
> ]
2320

2421

jscomp/test/demo_binding.ml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,52 @@
1-
[@@@bs.config{bs_class_type }]
21

32
class type titlex =
43
object
54
method title : string [@@bs.set] [@@bs.get {null ; undefined}]
6-
end
5+
end[@bs]
76

87
class type widget =
98
object
109
method on : string -> (event -> unit [@bs]) -> unit
11-
end
10+
end[@bs]
1211
and event =
1312
object
1413
method source : widget
1514
method target : widget
16-
end
15+
end[@bs]
1716

1817

1918
class type title =
2019
object
2120
method title : string [@@bs.set]
22-
end
21+
end[@bs]
2322

2423
class type text =
2524
object
2625
method text : string [@@bs.set]
27-
end
26+
end[@bs]
2827

2928
class type measure =
3029
object
3130
method minHeight : int [@@bs.set]
3231
method minWidth : int [@@bs.set]
3332
method maxHeight : int [@@bs.set]
3433
method maxWidth : int [@@bs.set]
35-
end
34+
end[@bs]
3635

3736
class type layout =
3837
object
3938
method orientation : string [@@bs.set]
40-
end
39+
end[@bs]
4140

4241
class type applicationContext =
4342
object
4443
method exit : int -> unit
45-
end
44+
end[@bs]
4645
class type contentable =
4746
object
4847
method content : #widget Js.t [@@bs.set]
4948
method contentWidth : int [@@bs.set]
50-
end
49+
end[@bs]
5150

5251
class type hostedWindow =
5352
object
@@ -58,13 +57,13 @@ class type hostedWindow =
5857
method hide : unit -> unit
5958
method focus : unit -> unit
6059
method appContext : applicationContext [@@bs.set]
61-
end
60+
end[@bs]
6261

6362
class type hostedContent =
6463
object
6564
inherit widget
6665
inherit contentable
67-
end
66+
end[@bs]
6867

6968

7069
class type stackPanel =
@@ -75,7 +74,7 @@ class type stackPanel =
7574

7675
method addChild : #widget Js.t -> unit
7776

78-
end
77+
end[@bs]
7978

8079
class type grid =
8180
object
@@ -86,22 +85,22 @@ class type grid =
8685
[%bs.obj: <label : <text : string; .. > ; ..> ] array [@@bs.set]
8786
method dataSource :
8887
[%bs.obj: <label : <text : string; .. > ; ..> ] array array [@@bs.set]
89-
end
88+
end[@bs]
9089

9190

9291
class type button =
9392
object
9493
inherit widget
9594
inherit text
9695
inherit measure
97-
end
96+
end[@bs]
9897

9998
class type textArea =
10099
object
101100
inherit widget
102101
inherit measure
103102
inherit text
104-
end
103+
end[@bs]
105104

106105

107106
external set_interval : (unit -> unit [@bs]) -> float -> unit = "setInterval"

jscomp/test/http_types.ml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
[@@@bs.config{bs_class_type }]
21
(**
32
[%bs (req Js.t * resp Js.t => unit ) => server Js.t
43
]
@@ -20,17 +19,17 @@ class type _resp =
2019
method statusCode : int [@@bs.set]
2120
method setHeader : string -> string -> unit
2221
method end_ : string -> unit
23-
end
22+
end[@bs]
2423
type resp = _resp Js.t
2524
class type _server =
2625
object
2726
method listen : int -> string -> (unit -> unit [@bs]) -> unit
28-
end
27+
end[@bs]
2928
type server = _server Js.t
3029
class type _http =
3130
object
3231
method createServer : (req -> resp -> unit [@bs]) -> server
33-
end
32+
end[@bs]
3433
type http = _http Js.t
3534

3635

0 commit comments

Comments
 (0)