Skip to content

Commit e172eb5

Browse files
committed
Fix Obj.magic, Obj.repr etc. appearing in JS output
1 parent 05d7afa commit e172eb5

20 files changed

+99
-194
lines changed

lib/es6/js_exn.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import * as Primitive_option from "./primitive_option.js";
55
let $$Error = "JsError";
66

77
function asJsExn(exn) {
8-
let t = exn;
9-
if (t.RE_EXN_ID === $$Error) {
10-
return Primitive_option.some(t._1);
8+
if (exn.RE_EXN_ID === $$Error) {
9+
return Primitive_option.some(exn._1);
1110
}
1211

1312
}

lib/es6/obj.js

+1-51
Original file line numberDiff line numberDiff line change
@@ -1,51 +1 @@
1-
2-
3-
4-
function magic(prim) {
5-
return prim;
6-
}
7-
8-
function repr(prim) {
9-
return prim;
10-
}
11-
12-
function obj(prim) {
13-
return prim;
14-
}
15-
16-
function tag(prim) {
17-
return prim.TAG;
18-
}
19-
20-
function size(prim) {
21-
return prim.length | 0;
22-
}
23-
24-
function field(prim0, prim1) {
25-
return prim0[prim1];
26-
}
27-
28-
function set_field(prim0, prim1, prim2) {
29-
prim0[prim1] = prim2;
30-
}
31-
32-
function dup(prim) {
33-
return {...prim};
34-
}
35-
36-
function update_dummy(prim0, prim1) {
37-
Object.assign(prim0, prim1);
38-
}
39-
40-
export {
41-
magic,
42-
repr,
43-
obj,
44-
tag,
45-
size,
46-
field,
47-
set_field,
48-
dup,
49-
update_dummy,
50-
}
51-
/* No side effect */
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

lib/js/js_exn.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ let Primitive_option = require("./primitive_option.js");
55
let $$Error = "JsError";
66

77
function asJsExn(exn) {
8-
let t = exn;
9-
if (t.RE_EXN_ID === $$Error) {
10-
return Primitive_option.some(t._1);
8+
if (exn.RE_EXN_ID === $$Error) {
9+
return Primitive_option.some(exn._1);
1110
}
1211

1312
}

lib/js/obj.js

+1-49
Original file line numberDiff line numberDiff line change
@@ -1,49 +1 @@
1-
'use strict';
2-
3-
4-
function magic(prim) {
5-
return prim;
6-
}
7-
8-
function repr(prim) {
9-
return prim;
10-
}
11-
12-
function obj(prim) {
13-
return prim;
14-
}
15-
16-
function tag(prim) {
17-
return prim.TAG;
18-
}
19-
20-
function size(prim) {
21-
return prim.length | 0;
22-
}
23-
24-
function field(prim0, prim1) {
25-
return prim0[prim1];
26-
}
27-
28-
function set_field(prim0, prim1, prim2) {
29-
prim0[prim1] = prim2;
30-
}
31-
32-
function dup(prim) {
33-
return {...prim};
34-
}
35-
36-
function update_dummy(prim0, prim1) {
37-
Object.assign(prim0, prim1);
38-
}
39-
40-
exports.magic = magic;
41-
exports.repr = repr;
42-
exports.obj = obj;
43-
exports.tag = tag;
44-
exports.size = size;
45-
exports.field = field;
46-
exports.set_field = set_field;
47-
exports.dup = dup;
48-
exports.update_dummy = update_dummy;
49-
/* No side effect */
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */

runtime/obj.res

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@
44

55
type t = Primitive_object_extern.t
66

7-
let magic = Primitive_object_extern.magic
7+
external magic: 'a => 'b = "%identity"
88

99
@deprecated("Do not use directly. This will be removed in v13")
10-
let repr = Primitive_object_extern.repr
10+
external repr: 'a => t = "%identity"
1111

1212
@deprecated("Do not use directly. This will be removed in v13")
13-
let obj = Primitive_object_extern.obj
13+
external obj: t => 'a = "%identity"
1414

1515
@deprecated("Do not use directly. This will be removed in v13")
16-
let tag = Primitive_object_extern.tag
16+
external tag: t => int = "%obj_tag"
1717

1818
@deprecated("Do not use directly. This will be removed in v13")
19-
let size = Primitive_object_extern.size
19+
external size: t => int = "%obj_size"
2020

2121
@deprecated("Do not use directly. This will be removed in v13")
22-
let field = Primitive_object_extern.getField
22+
external getField: (t, 'a) => t = "%obj_get_field"
2323

2424
@deprecated("Do not use directly. This will be removed in v13")
25-
let set_field = Primitive_object_extern.setField
25+
external setField: (t, 'a, t) => unit = "%obj_set_field"
2626

2727
@deprecated("Do not use directly. This will be removed in v13")
28-
let dup = Primitive_object_extern.dup
28+
external dup: t => t = "%obj_dup"
2929

30-
@deprecated("Do not use directly. This will be removed in v13")
31-
let update_dummy = Primitive_object_extern.updateDummy
30+
@deprecated("Do not use directly. This will be removed in v13") @scope("Object")
31+
external updateDummy: (t, t) => unit = "assign"

tests/tests/src/UntaggedVariants.js

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/tests/src/exception_raise_test.js

+2-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/tests/src/gpr_1946_test.js

+3-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/tests/src/gpr_4069_test.js

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/tests/src/int_poly_var.js

+4-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)