Skip to content

Commit 92fd541

Browse files
committed
remove legacy foward_tag
1 parent 6980539 commit 92fd541

File tree

4 files changed

+152
-197
lines changed

4 files changed

+152
-197
lines changed

jscomp/runtime/caml_js_exceptions.ml

+1-7
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ type t =
66
exception Error of t
77

88

9-
(**
10-
{[
11-
exception A of int;;
12-
let v = A 3 ;;
13-
Obj.tag (Obj.field (Obj.repr v) 0);;
14-
- : int = 248
15-
]}
9+
(**
1610
This function has to be in this module Since
1711
[Error] is defined here
1812
*)

jscomp/runtime/caml_obj.ml

+1-8
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,7 @@ let rec caml_equal (a : Obj.t) (b : Obj.t) : bool =
297297
(* [a] [b] could not be null, so it can not raise *)
298298
let tag_a = Obj.tag a in
299299
let tag_b = Obj.tag b in
300-
(* double_array_tag: 254
301-
forward_tag:250
302-
*)
303-
if tag_a = 250 then
304-
caml_equal (Obj.field a 0) b
305-
else if tag_b = 250 then
306-
caml_equal a (Obj.field b 0)
307-
else if tag_a = 248 (* object/exception *) then
300+
if tag_a = 248 (* object/exception *) then
308301
(Obj.magic (Obj.field a 1)) == (Obj.magic (Obj.field b 1 ))
309302
else if tag_a = 251 (* abstract_tag *) then
310303
raise (Invalid_argument "equal: abstract value")

lib/es6/caml_obj.js

+75-91
Original file line numberDiff line numberDiff line change
@@ -255,104 +255,88 @@ function caml_compare(a, b) {
255255
}
256256
}
257257

258-
function caml_equal(_a, _b) {
259-
while(true) {
260-
var b = _b;
261-
var a = _a;
262-
if (a === b) {
263-
return true;
264-
}
265-
var a_type = typeof a;
266-
if (a_type === "string" || a_type === "number" || a_type === "boolean" || a_type === "undefined" || a === null) {
267-
return false;
268-
}
269-
var b_type = typeof b;
270-
if (a_type === "function" || b_type === "function") {
271-
throw {
272-
RE_EXN_ID: "Invalid_argument",
273-
_1: "equal: functional value",
274-
Error: new Error()
275-
};
276-
}
277-
if (b_type === "number" || b_type === "undefined" || b === null) {
278-
return false;
279-
}
280-
var tag_a = a.tag | 0;
281-
var tag_b = b.tag | 0;
282-
if (tag_a === 250) {
283-
_a = a[0];
284-
continue ;
285-
}
286-
if (tag_b === 250) {
287-
_b = b[0];
288-
continue ;
289-
}
290-
if (tag_a === 248) {
291-
return a[1] === b[1];
292-
}
293-
if (tag_a === 251) {
294-
throw {
295-
RE_EXN_ID: "Invalid_argument",
296-
_1: "equal: abstract value",
297-
Error: new Error()
298-
};
299-
}
300-
if (tag_a !== tag_b) {
301-
return false;
302-
}
303-
if (tag_a === 256) {
304-
return a[1] === b[1];
305-
}
306-
var len_a = a.length | 0;
307-
var len_b = b.length | 0;
308-
if (len_a === len_b) {
309-
if (Array.isArray(a)) {
310-
var _i = 0;
311-
while(true) {
312-
var i = _i;
313-
if (i === len_a) {
314-
return true;
315-
}
316-
if (!caml_equal(a[i], b[i])) {
317-
return false;
318-
}
319-
_i = i + 1 | 0;
320-
continue ;
258+
function caml_equal(a, b) {
259+
if (a === b) {
260+
return true;
261+
}
262+
var a_type = typeof a;
263+
if (a_type === "string" || a_type === "number" || a_type === "boolean" || a_type === "undefined" || a === null) {
264+
return false;
265+
}
266+
var b_type = typeof b;
267+
if (a_type === "function" || b_type === "function") {
268+
throw {
269+
RE_EXN_ID: "Invalid_argument",
270+
_1: "equal: functional value",
271+
Error: new Error()
321272
};
322-
} else if ((a instanceof Date && b instanceof Date)) {
323-
return !(a > b || a < b);
324-
} else {
325-
var result = {
326-
contents: true
273+
}
274+
if (b_type === "number" || b_type === "undefined" || b === null) {
275+
return false;
276+
}
277+
var tag_a = a.tag | 0;
278+
var tag_b = b.tag | 0;
279+
if (tag_a === 248) {
280+
return a[1] === b[1];
281+
}
282+
if (tag_a === 251) {
283+
throw {
284+
RE_EXN_ID: "Invalid_argument",
285+
_1: "equal: abstract value",
286+
Error: new Error()
327287
};
328-
var do_key_a = (function(b,result){
329-
return function do_key_a(key) {
330-
if (!b.hasOwnProperty(key)) {
331-
result.contents = false;
332-
return ;
333-
}
334-
288+
}
289+
if (tag_a !== tag_b) {
290+
return false;
291+
}
292+
if (tag_a === 256) {
293+
return a[1] === b[1];
294+
}
295+
var len_a = a.length | 0;
296+
var len_b = b.length | 0;
297+
if (len_a === len_b) {
298+
if (Array.isArray(a)) {
299+
var _i = 0;
300+
while(true) {
301+
var i = _i;
302+
if (i === len_a) {
303+
return true;
335304
}
336-
}(b,result));
337-
var do_key_b = (function(a,b,result){
338-
return function do_key_b(key) {
339-
if (!a.hasOwnProperty(key) || !caml_equal(b[key], a[key])) {
340-
result.contents = false;
341-
return ;
342-
}
343-
305+
if (!caml_equal(a[i], b[i])) {
306+
return false;
344307
}
345-
}(a,b,result));
346-
for_in(a, do_key_a);
347-
if (result.contents) {
348-
for_in(b, do_key_b);
308+
_i = i + 1 | 0;
309+
continue ;
310+
};
311+
} else if ((a instanceof Date && b instanceof Date)) {
312+
return !(a > b || a < b);
313+
} else {
314+
var result = {
315+
contents: true
316+
};
317+
var do_key_a = function (key) {
318+
if (!b.hasOwnProperty(key)) {
319+
result.contents = false;
320+
return ;
349321
}
350-
return result.contents;
322+
323+
};
324+
var do_key_b = function (key) {
325+
if (!a.hasOwnProperty(key) || !caml_equal(b[key], a[key])) {
326+
result.contents = false;
327+
return ;
328+
}
329+
330+
};
331+
for_in(a, do_key_a);
332+
if (result.contents) {
333+
for_in(b, do_key_b);
351334
}
352-
} else {
353-
return false;
335+
return result.contents;
354336
}
355-
};
337+
} else {
338+
return false;
339+
}
356340
}
357341

358342
function caml_equal_null(x, y) {

lib/js/caml_obj.js

+75-91
Original file line numberDiff line numberDiff line change
@@ -255,104 +255,88 @@ function caml_compare(a, b) {
255255
}
256256
}
257257

258-
function caml_equal(_a, _b) {
259-
while(true) {
260-
var b = _b;
261-
var a = _a;
262-
if (a === b) {
263-
return true;
264-
}
265-
var a_type = typeof a;
266-
if (a_type === "string" || a_type === "number" || a_type === "boolean" || a_type === "undefined" || a === null) {
267-
return false;
268-
}
269-
var b_type = typeof b;
270-
if (a_type === "function" || b_type === "function") {
271-
throw {
272-
RE_EXN_ID: "Invalid_argument",
273-
_1: "equal: functional value",
274-
Error: new Error()
275-
};
276-
}
277-
if (b_type === "number" || b_type === "undefined" || b === null) {
278-
return false;
279-
}
280-
var tag_a = a.tag | 0;
281-
var tag_b = b.tag | 0;
282-
if (tag_a === 250) {
283-
_a = a[0];
284-
continue ;
285-
}
286-
if (tag_b === 250) {
287-
_b = b[0];
288-
continue ;
289-
}
290-
if (tag_a === 248) {
291-
return a[1] === b[1];
292-
}
293-
if (tag_a === 251) {
294-
throw {
295-
RE_EXN_ID: "Invalid_argument",
296-
_1: "equal: abstract value",
297-
Error: new Error()
298-
};
299-
}
300-
if (tag_a !== tag_b) {
301-
return false;
302-
}
303-
if (tag_a === 256) {
304-
return a[1] === b[1];
305-
}
306-
var len_a = a.length | 0;
307-
var len_b = b.length | 0;
308-
if (len_a === len_b) {
309-
if (Array.isArray(a)) {
310-
var _i = 0;
311-
while(true) {
312-
var i = _i;
313-
if (i === len_a) {
314-
return true;
315-
}
316-
if (!caml_equal(a[i], b[i])) {
317-
return false;
318-
}
319-
_i = i + 1 | 0;
320-
continue ;
258+
function caml_equal(a, b) {
259+
if (a === b) {
260+
return true;
261+
}
262+
var a_type = typeof a;
263+
if (a_type === "string" || a_type === "number" || a_type === "boolean" || a_type === "undefined" || a === null) {
264+
return false;
265+
}
266+
var b_type = typeof b;
267+
if (a_type === "function" || b_type === "function") {
268+
throw {
269+
RE_EXN_ID: "Invalid_argument",
270+
_1: "equal: functional value",
271+
Error: new Error()
321272
};
322-
} else if ((a instanceof Date && b instanceof Date)) {
323-
return !(a > b || a < b);
324-
} else {
325-
var result = {
326-
contents: true
273+
}
274+
if (b_type === "number" || b_type === "undefined" || b === null) {
275+
return false;
276+
}
277+
var tag_a = a.tag | 0;
278+
var tag_b = b.tag | 0;
279+
if (tag_a === 248) {
280+
return a[1] === b[1];
281+
}
282+
if (tag_a === 251) {
283+
throw {
284+
RE_EXN_ID: "Invalid_argument",
285+
_1: "equal: abstract value",
286+
Error: new Error()
327287
};
328-
var do_key_a = (function(b,result){
329-
return function do_key_a(key) {
330-
if (!b.hasOwnProperty(key)) {
331-
result.contents = false;
332-
return ;
333-
}
334-
288+
}
289+
if (tag_a !== tag_b) {
290+
return false;
291+
}
292+
if (tag_a === 256) {
293+
return a[1] === b[1];
294+
}
295+
var len_a = a.length | 0;
296+
var len_b = b.length | 0;
297+
if (len_a === len_b) {
298+
if (Array.isArray(a)) {
299+
var _i = 0;
300+
while(true) {
301+
var i = _i;
302+
if (i === len_a) {
303+
return true;
335304
}
336-
}(b,result));
337-
var do_key_b = (function(a,b,result){
338-
return function do_key_b(key) {
339-
if (!a.hasOwnProperty(key) || !caml_equal(b[key], a[key])) {
340-
result.contents = false;
341-
return ;
342-
}
343-
305+
if (!caml_equal(a[i], b[i])) {
306+
return false;
344307
}
345-
}(a,b,result));
346-
for_in(a, do_key_a);
347-
if (result.contents) {
348-
for_in(b, do_key_b);
308+
_i = i + 1 | 0;
309+
continue ;
310+
};
311+
} else if ((a instanceof Date && b instanceof Date)) {
312+
return !(a > b || a < b);
313+
} else {
314+
var result = {
315+
contents: true
316+
};
317+
var do_key_a = function (key) {
318+
if (!b.hasOwnProperty(key)) {
319+
result.contents = false;
320+
return ;
349321
}
350-
return result.contents;
322+
323+
};
324+
var do_key_b = function (key) {
325+
if (!a.hasOwnProperty(key) || !caml_equal(b[key], a[key])) {
326+
result.contents = false;
327+
return ;
328+
}
329+
330+
};
331+
for_in(a, do_key_a);
332+
if (result.contents) {
333+
for_in(b, do_key_b);
351334
}
352-
} else {
353-
return false;
335+
return result.contents;
354336
}
355-
};
337+
} else {
338+
return false;
339+
}
356340
}
357341

358342
function caml_equal_null(x, y) {

0 commit comments

Comments
 (0)