Skip to content

Commit

Permalink
snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
bobzhang committed Feb 13, 2017
1 parent 985dd05 commit 9d83b5d
Showing 1 changed file with 179 additions and 156 deletions.
335 changes: 179 additions & 156 deletions lib/es6/caml_obj.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ function caml_compare(_a, _b) {
while(true) {
var b = _b;
var a = _a;
if (typeof a === "string") {
var a_type = typeof a;
var b_type = typeof b;
if (a_type === "string") {
var x = a;
var y = b;
if (x < y) {
Expand All @@ -81,129 +83,141 @@ function caml_compare(_a, _b) {
return 1;
}
}
else if (typeof a === "number") {
return caml_int_compare(a, b);
}
else if (typeof a === "boolean" || typeof a === "null" || typeof a === "undefined") {
var x$1 = a;
var y$1 = b;
if (x$1 === y$1) {
return 0;
}
else if (x$1 < y$1) {
return -1;
}
else {
return 1;
}
}
else if (typeof a === "function" || typeof b === "function") {
throw [
Caml_builtin_exceptions.invalid_argument,
"compare: functional value"
];
}
else {
var tag_a = a.tag | 0;
var tag_b = b.tag | 0;
if (tag_a === 250) {
_a = a[0];
continue ;

}
else if (tag_b === 250) {
_b = b[0];
continue ;

}
else if (tag_a === 248) {
return caml_int_compare(a[1], b[1]);
var is_a_number = +(a_type === "number");
var is_b_number = +(b_type === "number");
if (is_a_number !== 0) {
if (is_b_number !== 0) {
return caml_int_compare(a, b);
}
else {
return -1;
}
}
else if (tag_a === 251) {
throw [
Caml_builtin_exceptions.invalid_argument,
"equal: abstract value"
];
else if (is_b_number !== 0) {
return 1;
}
else if (tag_a !== tag_b) {
if (tag_a < tag_b) {
else if (a_type === "boolean" || a_type === "null" || a_type === "undefined") {
var x$1 = a;
var y$1 = b;
if (x$1 === y$1) {
return 0;
}
else if (x$1 < y$1) {
return -1;
}
else {
return 1;
}
}
else if (a_type === "function" || b_type === "function") {
throw [
Caml_builtin_exceptions.invalid_argument,
"compare: functional value"
];
}
else {
var len_a = a.length;
var len_b = b.length;
if (len_a === len_b) {
var a$1 = a;
var b$1 = b;
var _i = 0;
var same_length = len_a;
while(true) {
var i = _i;
if (i === same_length) {
return 0;
}
else {
var res = caml_compare(a$1[i], b$1[i]);
if (res !== 0) {
return res;
var tag_a = a.tag | 0;
var tag_b = b.tag | 0;
if (tag_a === 250) {
_a = a[0];
continue ;

}
else if (tag_b === 250) {
_b = b[0];
continue ;

}
else if (tag_a === 248) {
return caml_int_compare(a[1], b[1]);
}
else if (tag_a === 251) {
throw [
Caml_builtin_exceptions.invalid_argument,
"equal: abstract value"
];
}
else if (tag_a !== tag_b) {
if (tag_a < tag_b) {
return -1;
}
else {
return 1;
}
}
else {
var len_a = a.length;
var len_b = b.length;
if (len_a === len_b) {
var a$1 = a;
var b$1 = b;
var _i = 0;
var same_length = len_a;
while(true) {
var i = _i;
if (i === same_length) {
return 0;
}
else {
_i = i + 1 | 0;
continue ;

var res = caml_compare(a$1[i], b$1[i]);
if (res !== 0) {
return res;
}
else {
_i = i + 1 | 0;
continue ;

}
}
}
};
}
else if (len_a < len_b) {
var a$2 = a;
var b$2 = b;
var _i$1 = 0;
var short_length = len_a;
while(true) {
var i$1 = _i$1;
if (i$1 === short_length) {
return -1;
}
else {
var res$1 = caml_compare(a$2[i$1], b$2[i$1]);
if (res$1 !== 0) {
return res$1;
};
}
else if (len_a < len_b) {
var a$2 = a;
var b$2 = b;
var _i$1 = 0;
var short_length = len_a;
while(true) {
var i$1 = _i$1;
if (i$1 === short_length) {
return -1;
}
else {
_i$1 = i$1 + 1 | 0;
continue ;

var res$1 = caml_compare(a$2[i$1], b$2[i$1]);
if (res$1 !== 0) {
return res$1;
}
else {
_i$1 = i$1 + 1 | 0;
continue ;

}
}
}
};
}
else {
var a$3 = a;
var b$3 = b;
var _i$2 = 0;
var short_length$1 = len_b;
while(true) {
var i$2 = _i$2;
if (i$2 === short_length$1) {
return 1;
}
else {
var res$2 = caml_compare(a$3[i$2], b$3[i$2]);
if (res$2 !== 0) {
return res$2;
};
}
else {
var a$3 = a;
var b$3 = b;
var _i$2 = 0;
var short_length$1 = len_b;
while(true) {
var i$2 = _i$2;
if (i$2 === short_length$1) {
return 1;
}
else {
_i$2 = i$2 + 1 | 0;
continue ;

var res$2 = caml_compare(a$3[i$2], b$3[i$2]);
if (res$2 !== 0) {
return res$2;
}
else {
_i$2 = i$2 + 1 | 0;
continue ;

}
}
}
};
};
}
}
}
}
Expand All @@ -217,65 +231,74 @@ function caml_equal(_a, _b) {
if (a === b) {
return /* true */1;
}
else if (typeof a === "string" || typeof a === "number" || typeof a === "boolean" || typeof a === "undefined" || typeof a === "null") {
return /* false */0;
}
else if (typeof a === "function" || typeof b === "function") {
throw [
Caml_builtin_exceptions.invalid_argument,
"equal: functional value"
];
}
else {
var tag_a = a.tag | 0;
var tag_b = b.tag | 0;
if (tag_a === 250) {
_a = a[0];
continue ;

}
else if (tag_b === 250) {
_b = b[0];
continue ;

}
else if (tag_a === 248) {
return +(a[1] === b[1]);
}
else if (tag_a === 251) {
throw [
Caml_builtin_exceptions.invalid_argument,
"equal: abstract value"
];
}
else if (tag_a !== tag_b) {
var a_type = typeof a;
if (a_type === "string" || a_type === "number" || a_type === "boolean" || a_type === "undefined" || a_type === "null") {
return /* false */0;
}
else {
var len_a = a.length;
var len_b = b.length;
if (len_a === len_b) {
var a$1 = a;
var b$1 = b;
var _i = 0;
var same_length = len_a;
while(true) {
var i = _i;
if (i === same_length) {
return /* true */1;
}
else if (caml_equal(a$1[i], b$1[i])) {
_i = i + 1 | 0;
continue ;

var b_type = typeof b;
if (a_type === "function" || b_type === "function") {
throw [
Caml_builtin_exceptions.invalid_argument,
"equal: functional value"
];
}
else if (b_type === "number" || b_type === "null" || b_type === "undefined") {
return /* false */0;
}
else {
var tag_a = a.tag | 0;
var tag_b = b.tag | 0;
if (tag_a === 250) {
_a = a[0];
continue ;

}
else if (tag_b === 250) {
_b = b[0];
continue ;

}
else if (tag_a === 248) {
return +(a[1] === b[1]);
}
else if (tag_a === 251) {
throw [
Caml_builtin_exceptions.invalid_argument,
"equal: abstract value"
];
}
else if (tag_a !== tag_b) {
return /* false */0;
}
else {
var len_a = a.length;
var len_b = b.length;
if (len_a === len_b) {
var a$1 = a;
var b$1 = b;
var _i = 0;
var same_length = len_a;
while(true) {
var i = _i;
if (i === same_length) {
return /* true */1;
}
else if (caml_equal(a$1[i], b$1[i])) {
_i = i + 1 | 0;
continue ;

}
else {
return /* false */0;
}
};
}
else {
return /* false */0;
}
};
}
else {
return /* false */0;
}
}
}
}
Expand Down

0 comments on commit 9d83b5d

Please sign in to comment.