Skip to content

Commit 88c72ee

Browse files
authored
Merge pull request #3985 from BuckleScript/precise_pointer_info
prepare for singleton variant -> undefined
2 parents b311b9c + 547df72 commit 88c72ee

31 files changed

+244
-175
lines changed

jscomp/core/lam.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ let false_ : t =
410410
Lconst (Const_js_false)
411411

412412
let unit : t =
413-
Lconst (Const_pointer( 0, Pt_constructor "()"))
413+
Lconst (Const_pointer( 0, Pt_constructor {name = "()"; cstrs = 1,0}))
414414

415415

416416

jscomp/core/lam_compile_util.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ let comment_of_tag_info (x : Lam_tag_info.t) =
6161
| Blk_na s -> if s = "" then None else Some s
6262
let comment_of_pointer_info (x : Lam_pointer_info.t)=
6363
match x with
64-
| Pt_constructor x -> Some x
65-
| Pt_variant x -> Some x
64+
| Pt_constructor {name}
65+
| Pt_variant {name} -> Some name
6666
| Pt_module_alias -> None (* FIXME *)
6767
| Pt_na -> None

jscomp/core/lam_constant_convert.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ let rec convert_constant ( const : Lambda.structured_constant) : Lam_constant.t
4040
| Const_base (Const_nativeint i) -> (Const_nativeint i)
4141
| Const_pointer(i,p) ->
4242
begin match p with
43-
| Pt_constructor p -> Const_pointer(i, Pt_constructor p)
44-
| Pt_variant p -> Const_pointer(i,Pt_variant p)
43+
| Pt_constructor {name;cstrs} -> Const_pointer(i, Pt_constructor {name; cstrs})
44+
| Pt_variant {name} -> Const_pointer(i,Pt_variant {name})
4545
| Pt_module_alias -> Const_pointer(i, Pt_module_alias)
4646
| Pt_builtin_boolean -> if i = 0 then Const_js_false else Const_js_true
4747
| Pt_shape_none ->

jscomp/core/lam_pointer_info.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
type t =
27-
| Pt_constructor of string
28-
| Pt_variant of string
27+
| Pt_constructor of {name : string ; cstrs : int * int}
28+
| Pt_variant of {name : string }
2929
| Pt_module_alias
3030
| Pt_na

jscomp/core/lam_pointer_info.mli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525

2626
type t =
27-
| Pt_constructor of string
28-
| Pt_variant of string
27+
| Pt_constructor of {name : string ; cstrs : int * int}
28+
| Pt_variant of { name : string}
2929
| Pt_module_alias
3030
| Pt_na

jscomp/runtime/release.ninja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ build runtime/caml_format.cmj : cc_cmi runtime/caml_format.ml | runtime/caml_bui
3232
build runtime/caml_format.cmi : cc runtime/caml_format.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
3333
build runtime/caml_gc.cmj : cc_cmi runtime/caml_gc.ml | runtime/caml_gc.cmi
3434
build runtime/caml_gc.cmi : cc runtime/caml_gc.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj
35-
build runtime/caml_hash.cmj : cc_cmi runtime/caml_hash.ml | runtime/caml_builtin_exceptions.cmj runtime/caml_hash.cmi runtime/caml_hash_primitive.cmj runtime/caml_nativeint_extern.cmj runtime/caml_obj_extern.cmj runtime/caml_undefined_extern.cmj runtime/js.cmj
35+
build runtime/caml_hash.cmj : cc_cmi runtime/caml_hash.ml | runtime/caml_builtin_exceptions.cmj runtime/caml_hash.cmi runtime/caml_hash_primitive.cmj runtime/caml_nativeint_extern.cmj runtime/caml_obj_extern.cmj runtime/js.cmj
3636
build runtime/caml_hash.cmi : cc runtime/caml_hash.mli | runtime/bs_stdlib_mini.cmi runtime/caml_obj_extern.cmj runtime/js.cmi runtime/js.cmj
3737
build runtime/caml_hash_primitive.cmj : cc_cmi runtime/caml_hash_primitive.ml | runtime/caml_char.cmj runtime/caml_hash_primitive.cmi runtime/caml_int32.cmj runtime/caml_nativeint_extern.cmj runtime/caml_string_extern.cmj
3838
build runtime/caml_hash_primitive.cmi : cc runtime/caml_hash_primitive.mli | runtime/bs_stdlib_mini.cmi runtime/js.cmi runtime/js.cmj

jscomp/test/build.ninja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ build test/simple_derive_use.cmi : cc test/simple_derive_use.mli | $stdlib
526526
build test/simple_lexer_test.cmi test/simple_lexer_test.cmj : cc test/simple_lexer_test.ml | test/mt.cmj $stdlib
527527
build test/simplify_lambda_632o.cmi test/simplify_lambda_632o.cmj : cc test/simplify_lambda_632o.ml | $stdlib
528528
build test/single_module_alias.cmi test/single_module_alias.cmj : cc test/single_module_alias.ml | $stdlib
529+
build test/singular_unit_test.cmi test/singular_unit_test.cmj : cc test/singular_unit_test.ml | $stdlib
529530
build test/small_inline_test.cmi test/small_inline_test.cmj : cc test/small_inline_test.ml | $stdlib
530531
build test/splice_test.cmi test/splice_test.cmj : cc test/splice_test.ml | test/mt.cmj $stdlib
531532
build test/sprintf_reg_test.cmi test/sprintf_reg_test.cmj : cc test/sprintf_reg_test.ml | test/mt.cmj test/mt_global.cmj $stdlib

jscomp/test/class3_test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ function vpoint_init($$class) {
349349
var move = ids[0];
350350
var get_x = ids[1];
351351
var x = ids[2];
352-
var inh = CamlinternalOO.inherits($$class, 0, shared$5, /* array */["get_offset"], abstract_point, 1);
352+
var inh = CamlinternalOO.inherits($$class, 0, shared$5, /* array */["get_offset"], abstract_point, true);
353353
var obj_init = inh[0];
354354
CamlinternalOO.set_methods($$class, /* array */[
355355
get_x,
@@ -404,7 +404,7 @@ var abstract_point2 = /* class */[
404404
function point2_init($$class) {
405405
var x_init = CamlinternalOO.new_variable($$class, "");
406406
var get_offset = CamlinternalOO.get_method_label($$class, "get_offset");
407-
var inh = CamlinternalOO.inherits($$class, shared$3, 0, shared$8, abstract_point2, 1);
407+
var inh = CamlinternalOO.inherits($$class, shared$3, 0, shared$8, abstract_point2, true);
408408
var obj_init = inh[0];
409409
var x = inh[1];
410410
CamlinternalOO.set_method($$class, get_offset, (function (self$10) {
@@ -482,7 +482,7 @@ eq("File \"class3_test.ml\", line 144, characters 12-19", h$2, 1);
482482
function point_again_init($$class) {
483483
var x = CamlinternalOO.new_variable($$class, "");
484484
CamlinternalOO.get_method_label($$class, "move");
485-
var inh = CamlinternalOO.inherits($$class, shared$3, 0, shared$7, restricted_point, 1);
485+
var inh = CamlinternalOO.inherits($$class, shared$3, 0, shared$7, restricted_point, true);
486486
var obj_init = inh[0];
487487
return (function (env, self, x$1) {
488488
var self$1 = CamlinternalOO.create_object_opt(self, $$class);
@@ -508,7 +508,7 @@ eq("File \"class3_test.ml\", line 161, characters 12-19", hh, 8);
508508

509509
function point_again2_init($$class) {
510510
var x = CamlinternalOO.new_variable($$class, "");
511-
var inh = CamlinternalOO.inherits($$class, shared$3, 0, shared$7, restricted_point, 1);
511+
var inh = CamlinternalOO.inherits($$class, shared$3, 0, shared$7, restricted_point, true);
512512
var obj_init = inh[0];
513513
return (function (env, self, x$1) {
514514
var self$1 = CamlinternalOO.create_object_opt(self, $$class);
@@ -535,7 +535,7 @@ eq("File \"class3_test.ml\", line 177, characters 12-19", hhh, 35);
535535
function point_again3_init($$class) {
536536
var x = CamlinternalOO.new_variable($$class, "");
537537
var move = CamlinternalOO.get_method_label($$class, "move");
538-
var inh = CamlinternalOO.inherits($$class, shared$3, 0, shared$7, restricted_point, 1);
538+
var inh = CamlinternalOO.inherits($$class, shared$3, 0, shared$7, restricted_point, true);
539539
var obj_init = inh[0];
540540
var move$1 = inh[4];
541541
CamlinternalOO.set_method($$class, move, Curry.__1(move$1));

jscomp/test/class4_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function restricted_point_init($$class) {
8080
var restricted_point = CamlinternalOO.make_class(shared$2, restricted_point_init);
8181

8282
function restricted_point$prime_init($$class) {
83-
var inh = CamlinternalOO.inherits($$class, 0, 0, shared$2, restricted_point, 1);
83+
var inh = CamlinternalOO.inherits($$class, 0, 0, shared$2, restricted_point, true);
8484
var obj_init = inh[0];
8585
return (function (env, self, x) {
8686
return Curry._2(obj_init, self, x);
@@ -90,7 +90,7 @@ function restricted_point$prime_init($$class) {
9090
var restricted_point$prime = CamlinternalOO.make_class(shared$2, restricted_point$prime_init);
9191

9292
function restricted_point2$prime_init($$class) {
93-
var inh = CamlinternalOO.inherits($$class, 0, 0, shared$2, restricted_point, 1);
93+
var inh = CamlinternalOO.inherits($$class, 0, 0, shared$2, restricted_point, true);
9494
var obj_init = inh[0];
9595
return (function (env, self, x) {
9696
return Curry._2(obj_init, self, x);
@@ -135,7 +135,7 @@ function point_init($$class) {
135135
var move = ids[0];
136136
var get_x = ids[1];
137137
var x = ids[2];
138-
var inh = CamlinternalOO.inherits($$class, 0, shared$1, /* array */["get_offset"], abstract_point, 1);
138+
var inh = CamlinternalOO.inherits($$class, 0, shared$1, /* array */["get_offset"], abstract_point, true);
139139
var obj_init = inh[0];
140140
CamlinternalOO.set_methods($$class, /* array */[
141141
get_x,
@@ -173,7 +173,7 @@ function colored_point_init($$class) {
173173
"get_offset",
174174
"get_x",
175175
"move"
176-
], point, 1);
176+
], point, true);
177177
var obj_init = inh[0];
178178
CamlinternalOO.set_method($$class, color, (function (self$7) {
179179
return self$7[c$1];

jscomp/test/class5_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function printable_colored_point_init($$class) {
102102
"get_x",
103103
"move",
104104
"print"
105-
], printable_point, 1);
105+
], printable_point, true);
106106
var obj_init = inh[0];
107107
var print$1 = inh[4];
108108
CamlinternalOO.set_method($$class, print, (function (self$2) {
@@ -289,7 +289,7 @@ function distance_point_init($$class) {
289289
var inh = CamlinternalOO.inherits($$class, shared$1, 0, /* array */[
290290
"get_x",
291291
"move"
292-
], point, 1);
292+
], point, true);
293293
var obj_init = inh[0];
294294
var x$1 = inh[1];
295295
CamlinternalOO.set_method($$class, distance, (function (self$7, other) {

0 commit comments

Comments
 (0)