Skip to content

Commit 91b31fa

Browse files
committed
fix #3967
1 parent bb7b40c commit 91b31fa

File tree

7 files changed

+49
-10
lines changed

7 files changed

+49
-10
lines changed

jscomp/core/js_exp_make.ml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,20 @@ let dummy_obj ?comment (info : Lam_tag_info.t) : t =
289289
for record it is [{}]
290290
for other it is [[]]
291291
*)
292-
{comment ; expression_desc = Array ([],Mutable)}
292+
match info with
293+
| Blk_record _
294+
| Blk_module _
295+
->
296+
{comment ; expression_desc = Object ([])}
297+
| Blk_constructor _
298+
| Blk_tuple | Blk_array
299+
| Blk_variant _ | Blk_extension_slot
300+
| Blk_extension | Blk_na _
301+
| Blk_record_inlined _
302+
| Blk_record_ext _
303+
| Blk_class | Blk_module_export
304+
->
305+
{comment ; expression_desc = Array ([],Mutable)}
293306

294307

295308
(* TODO: complete

jscomp/test/gpr_1716_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ function eq(loc, x, y) {
2929
return /* () */0;
3030
}
3131

32-
var a = [];
32+
var a = { };
3333

34-
var b = [];
34+
var b = { };
3535

3636
Caml_obj.caml_update_dummy(a, {
3737
b: b

jscomp/test/queue_402.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function clear(q) {
2121

2222
function add(x, q) {
2323
if (q.length === 0) {
24-
var cell = [];
24+
var cell = { };
2525
cell.content = x;
2626
cell.next = cell;
2727
q.length = 1;
@@ -71,7 +71,7 @@ function copy(q) {
7171
};
7272
} else {
7373
var tail = q.tail;
74-
var tail$prime = [];
74+
var tail$prime = { };
7575
Caml_obj.caml_update_dummy(tail$prime, {
7676
content: tail.content,
7777
next: tail$prime

jscomp/test/rec_fun_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var called = {
3535
};
3636

3737
function g(param) {
38-
var v = [];
38+
var v = { };
3939
var next = function (i, b) {
4040
called.contents = called.contents + 1 | 0;
4141
if (b) {

jscomp/test/recursive_records_test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ function eq(loc, x, y) {
1818
return Mt.eq_suites(test_id, suites, loc, x, y);
1919
}
2020

21-
var rec_cell = [];
21+
var rec_cell = { };
2222

2323
rec_cell.content = 3;
2424

2525
rec_cell.next = rec_cell;
2626

2727
function f0(x) {
28-
var rec_cell = [];
28+
var rec_cell = { };
2929
Caml_obj.caml_update_dummy(rec_cell, {
3030
content: Caml_int32.imul(x, x) - 6 | 0,
3131
next: rec_cell

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95035,7 +95035,20 @@ let dummy_obj ?comment (info : Lam_tag_info.t) : t =
9503595035
for record it is [{}]
9503695036
for other it is [[]]
9503795037
*)
95038-
{comment ; expression_desc = Array ([],Mutable)}
95038+
match info with
95039+
| Blk_record _
95040+
| Blk_module _
95041+
->
95042+
{comment ; expression_desc = Object ([])}
95043+
| Blk_constructor _
95044+
| Blk_tuple | Blk_array
95045+
| Blk_variant _ | Blk_extension_slot
95046+
| Blk_extension | Blk_na _
95047+
| Blk_record_inlined _
95048+
| Blk_record_ext _
95049+
| Blk_class | Blk_module_export
95050+
->
95051+
{comment ; expression_desc = Array ([],Mutable)}
9503995052

9504095053

9504195054
(* TODO: complete

lib/4.06.1/whole_compiler.ml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85968,7 +85968,20 @@ let dummy_obj ?comment (info : Lam_tag_info.t) : t =
8596885968
for record it is [{}]
8596985969
for other it is [[]]
8597085970
*)
85971-
{comment ; expression_desc = Array ([],Mutable)}
85971+
match info with
85972+
| Blk_record _
85973+
| Blk_module _
85974+
->
85975+
{comment ; expression_desc = Object ([])}
85976+
| Blk_constructor _
85977+
| Blk_tuple | Blk_array
85978+
| Blk_variant _ | Blk_extension_slot
85979+
| Blk_extension | Blk_na _
85980+
| Blk_record_inlined _
85981+
| Blk_record_ext _
85982+
| Blk_class | Blk_module_export
85983+
->
85984+
{comment ; expression_desc = Array ([],Mutable)}
8597285985

8597385986

8597485987
(* TODO: complete

0 commit comments

Comments
 (0)