Skip to content

Commit 45924dc

Browse files
committed
Use blocks for payloads but string for tags.
1 parent 37cd85b commit 45924dc

File tree

306 files changed

+40837
-53587
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+40837
-53587
lines changed

jscomp/core/js_exp_make.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,16 @@ let make_block ?comment
186186
let name = match Lam_compile_util.comment_of_tag_info tag_info with
187187
| Some s -> s
188188
| None -> assert false in
189-
(* {
189+
{
190190
expression_desc = Caml_block( es, mutable_flag, str name, tag_info) ;
191191
comment
192-
} *)
193-
let comment = Some "constructor" in
192+
}
193+
(* let comment = Some "constructor" in
194194
let property_map = [
195195
("tag", str name);
196196
]
197197
@ List.mapi (fun n e -> (string_of_int n, e)) es in
198-
{expression_desc = Object property_map; comment}
198+
{expression_desc = Object property_map; comment} *)
199199
| _ ->
200200
let comment =
201201
match comment with

jscomp/test/a_filename_test.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var Mt = require("./mt.js");
44
var $$Array = require("../../lib/js/array.js");
5+
var Block = require("../../lib/js/block.js");
56
var Ext_filename_test = require("./ext_filename_test.js");
67

78
var suites = /* record */[/* contents */"[]"];
@@ -10,20 +11,18 @@ var test_id = /* record */[/* contents */0];
1011

1112
function eq(loc, x, y) {
1213
test_id[0] = test_id[0] + 1 | 0;
13-
suites[0] = /* constructor */{
14-
tag: "::",
15-
"0": /* tuple */[
16-
loc + (" id " + String(test_id[0])),
17-
(function (param) {
18-
return /* constructor */{
19-
tag: "Eq",
20-
"0": x,
21-
"1": y
22-
};
23-
})
24-
],
25-
"1": suites[0]
26-
};
14+
suites[0] = Block.__("::", [
15+
/* tuple */[
16+
loc + (" id " + String(test_id[0])),
17+
(function (param) {
18+
return Block.__("Eq", [
19+
x,
20+
y
21+
]);
22+
})
23+
],
24+
suites[0]
25+
]);
2726
return /* () */0;
2827
}
2928

jscomp/test/a_list_test.js

Lines changed: 98 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,110 @@
11
'use strict';
22

33
var Mt = require("./mt.js");
4+
var Block = require("../../lib/js/block.js");
45
var Ext_list_test = require("./ext_list_test.js");
56

6-
var suites = /* constructor */{
7-
tag: "::",
8-
"0": /* tuple */[
9-
"drop",
10-
(function (param) {
11-
return /* constructor */{
12-
tag: "Eq",
13-
"0": Ext_list_test.drop(3, /* constructor */{
14-
tag: "::",
15-
"0": 0,
16-
"1": /* constructor */{
17-
tag: "::",
18-
"0": 1,
19-
"1": /* constructor */{
20-
tag: "::",
21-
"0": 2,
22-
"1": "[]"
23-
}
24-
}
25-
}),
26-
"1": "[]"
27-
};
28-
})
29-
],
30-
"1": /* constructor */{
31-
tag: "::",
32-
"0": /* tuple */[
7+
var suites_000 = /* tuple */[
8+
"drop",
9+
(function (param) {
10+
return Block.__("Eq", [
11+
Ext_list_test.drop(3, Block.__("::", [
12+
0,
13+
Block.__("::", [
14+
1,
15+
Block.__("::", [
16+
2,
17+
"[]"
18+
])
19+
])
20+
])),
21+
"[]"
22+
]);
23+
})
24+
];
25+
26+
var suites_001 = Block.__("::", [
27+
/* tuple */[
3328
"drop1",
3429
(function (param) {
35-
return /* constructor */{
36-
tag: "Eq",
37-
"0": Ext_list_test.drop(2, /* constructor */{
38-
tag: "::",
39-
"0": 0,
40-
"1": /* constructor */{
41-
tag: "::",
42-
"0": 1,
43-
"1": /* constructor */{
44-
tag: "::",
45-
"0": 2,
46-
"1": "[]"
47-
}
48-
}
49-
}),
50-
"1": /* constructor */{
51-
tag: "::",
52-
"0": 2,
53-
"1": "[]"
54-
}
55-
};
30+
return Block.__("Eq", [
31+
Ext_list_test.drop(2, Block.__("::", [
32+
0,
33+
Block.__("::", [
34+
1,
35+
Block.__("::", [
36+
2,
37+
"[]"
38+
])
39+
])
40+
])),
41+
Block.__("::", [
42+
2,
43+
"[]"
44+
])
45+
]);
5646
})
5747
],
58-
"1": /* constructor */{
59-
tag: "::",
60-
"0": /* tuple */[
61-
"flat_map",
62-
(function (param) {
63-
return /* constructor */{
64-
tag: "Eq",
65-
"0": /* constructor */{
66-
tag: "::",
67-
"0": 0,
68-
"1": /* constructor */{
69-
tag: "::",
70-
"0": 0,
71-
"1": /* constructor */{
72-
tag: "::",
73-
"0": 1,
74-
"1": /* constructor */{
75-
tag: "::",
76-
"0": 1,
77-
"1": /* constructor */{
78-
tag: "::",
79-
"0": 0,
80-
"1": "[]"
81-
}
82-
}
83-
}
84-
}
85-
},
86-
"1": Ext_list_test.flat_map((function (x) {
87-
if (x % 2 === 0) {
88-
return /* constructor */{
89-
tag: "::",
90-
"0": 0,
91-
"1": "[]"
92-
};
93-
} else {
94-
return /* constructor */{
95-
tag: "::",
96-
"0": 1,
97-
"1": /* constructor */{
98-
tag: "::",
99-
"0": 1,
100-
"1": "[]"
101-
}
102-
};
103-
}
104-
}), /* constructor */{
105-
tag: "::",
106-
"0": 0,
107-
"1": /* constructor */{
108-
tag: "::",
109-
"0": 0,
110-
"1": /* constructor */{
111-
tag: "::",
112-
"0": 3,
113-
"1": /* constructor */{
114-
tag: "::",
115-
"0": 0,
116-
"1": "[]"
117-
}
118-
}
119-
}
120-
})
121-
};
122-
})
123-
],
124-
"1": "[]"
125-
}
126-
}
127-
};
48+
Block.__("::", [
49+
/* tuple */[
50+
"flat_map",
51+
(function (param) {
52+
return Block.__("Eq", [
53+
Block.__("::", [
54+
0,
55+
Block.__("::", [
56+
0,
57+
Block.__("::", [
58+
1,
59+
Block.__("::", [
60+
1,
61+
Block.__("::", [
62+
0,
63+
"[]"
64+
])
65+
])
66+
])
67+
])
68+
]),
69+
Ext_list_test.flat_map((function (x) {
70+
if (x % 2 === 0) {
71+
return Block.__("::", [
72+
0,
73+
"[]"
74+
]);
75+
} else {
76+
return Block.__("::", [
77+
1,
78+
Block.__("::", [
79+
1,
80+
"[]"
81+
])
82+
]);
83+
}
84+
}), Block.__("::", [
85+
0,
86+
Block.__("::", [
87+
0,
88+
Block.__("::", [
89+
3,
90+
Block.__("::", [
91+
0,
92+
"[]"
93+
])
94+
])
95+
])
96+
]))
97+
]);
98+
})
99+
],
100+
"[]"
101+
])
102+
]);
103+
104+
var suites = Block.__("::", [
105+
suites_000,
106+
suites_001
107+
]);
128108

129109
Mt.from_pair_suites("A_list_test", suites);
130110

jscomp/test/a_recursive_type.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
'use strict';
22

3+
var Block = require("../../lib/js/block.js");
34
var Curry = require("../../lib/js/curry.js");
45

56
function g(x) {
67
return Curry._1(x[0], x);
78
}
89

9-
var loop = g(/* constructor */{
10-
tag: "A",
11-
"0": g
12-
});
10+
var loop = g(Block.__("A", [g]));
1311

14-
var x = /* constructor */{
15-
tag: "A",
16-
"0": g
17-
};
12+
var x = Block.__("A", [g]);
1813

1914
var non_terminate = g(x);
2015

0 commit comments

Comments
 (0)