Skip to content

Commit b720eca

Browse files
committed
stricter semantics for if not none since we are going to unbox optional very soon
1 parent c6709a4 commit b720eca

34 files changed

+128
-120
lines changed

lib/js/arg.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function usage(speclist, errmsg) {
187187
var current = [0];
188188

189189
function parse_argv_dynamic($staropt$star, argv, speclist, anonfun, errmsg) {
190-
var current$1 = $staropt$star ? $staropt$star[0] : current;
190+
var current$1 = $staropt$star !== /* None */0 ? $staropt$star[0] : current;
191191
var l = argv.length;
192192
var b = $$Buffer.create(200);
193193
var initpos = current$1[0];
@@ -583,7 +583,7 @@ function parse_argv_dynamic($staropt$star, argv, speclist, anonfun, errmsg) {
583583
}
584584

585585
function parse_argv($staropt$star, argv, speclist, anonfun, errmsg) {
586-
var current$1 = $staropt$star ? $staropt$star[0] : current;
586+
var current$1 = $staropt$star !== /* None */0 ? $staropt$star[0] : current;
587587
return parse_argv_dynamic(/* Some */[current$1], argv, [speclist], anonfun, errmsg);
588588
}
589589

@@ -682,7 +682,7 @@ function max_arg_len(cur, param) {
682682
}
683683

684684
function align($staropt$star, speclist) {
685-
var limit = $staropt$star ? $staropt$star[0] : Pervasives.max_int;
685+
var limit = $staropt$star !== /* None */0 ? $staropt$star[0] : Pervasives.max_int;
686686
var completed = add_help(speclist);
687687
var len = List.fold_left(max_arg_len, 0, completed);
688688
var len$1 = len < limit ? len : limit;

lib/js/belt_Array.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ function keepMapU(a, f) {
338338
for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){
339339
var v = a[i];
340340
var match = f(v);
341-
if (match) {
341+
if (match !== /* None */0) {
342342
r[j] = match[0];
343343
j = j + 1 | 0;
344344
}

lib/js/belt_List.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function copyAuxWitFilterMap(f, _cellX, _prec) {
199199
if (cellX) {
200200
var t = cellX[1];
201201
var match = f(cellX[0]);
202-
if (match) {
202+
if (match !== /* None */0) {
203203
var next = /* :: */[
204204
match[0],
205205
/* [] */0
@@ -464,7 +464,7 @@ function splitAt(lst, n) {
464464
/* [] */0
465465
];
466466
var rest = splitAtAux(n - 1 | 0, lst[1], cell);
467-
if (rest) {
467+
if (rest !== /* None */0) {
468468
return /* Some */[/* tuple */[
469469
cell,
470470
rest[0]
@@ -1274,7 +1274,7 @@ function keepMapU(_xs, p) {
12741274
if (xs) {
12751275
var t = xs[1];
12761276
var match = p(xs[0]);
1277-
if (match) {
1277+
if (match !== /* None */0) {
12781278
var cell = /* :: */[
12791279
match[0],
12801280
/* [] */0

lib/js/belt_MapDict.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function updateU(t, newK, f, cmp) {
3030
var c = cmp(newK, k);
3131
if (c === 0) {
3232
var match = f(/* Some */[t.value]);
33-
if (match) {
33+
if (match !== /* None */0) {
3434
return Belt_internalAVLtree.updateValue(t, match[0]);
3535
} else {
3636
var l = t.left;
@@ -70,7 +70,7 @@ function updateU(t, newK, f, cmp) {
7070
}
7171
} else {
7272
var match$1 = f(/* None */0);
73-
if (match$1) {
73+
if (match$1 !== /* None */0) {
7474
return Belt_internalAVLtree.singleton(newK, match$1[0]);
7575
} else {
7676
return t;

lib/js/belt_MapInt.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function updateU(t, x, f) {
2727
var k = t.key;
2828
if (x === k) {
2929
var match = f(/* Some */[t.value]);
30-
if (match) {
30+
if (match !== /* None */0) {
3131
return Belt_internalAVLtree.updateValue(t, match[0]);
3232
} else {
3333
var l = t.left;
@@ -67,7 +67,7 @@ function updateU(t, x, f) {
6767
}
6868
} else {
6969
var match$1 = f(/* None */0);
70-
if (match$1) {
70+
if (match$1 !== /* None */0) {
7171
return Belt_internalAVLtree.singleton(x, match$1[0]);
7272
} else {
7373
return t;

lib/js/belt_MapString.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function updateU(t, x, f) {
2727
var k = t.key;
2828
if (x === k) {
2929
var match = f(/* Some */[t.value]);
30-
if (match) {
30+
if (match !== /* None */0) {
3131
return Belt_internalAVLtree.updateValue(t, match[0]);
3232
} else {
3333
var l = t.left;
@@ -67,7 +67,7 @@ function updateU(t, x, f) {
6767
}
6868
} else {
6969
var match$1 = f(/* None */0);
70-
if (match$1) {
70+
if (match$1 !== /* None */0) {
7171
return Belt_internalAVLtree.singleton(x, match$1[0]);
7272
} else {
7373
return t;

lib/js/belt_MutableMap.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function updateDone(t, x, f, cmp) {
9797
var c = cmp(x, k);
9898
if (c === 0) {
9999
var match = f(/* Some */[t.value]);
100-
if (match) {
100+
if (match !== /* None */0) {
101101
t.value = match[0];
102102
return t;
103103
} else {
@@ -129,7 +129,7 @@ function updateDone(t, x, f, cmp) {
129129
}
130130
} else {
131131
var match$1 = f(/* None */0);
132-
if (match$1) {
132+
if (match$1 !== /* None */0) {
133133
return Belt_internalAVLtree.singleton(x, match$1[0]);
134134
} else {
135135
return t;

lib/js/belt_MutableMapInt.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function updateDone(t, x, f) {
197197
var k = t.key;
198198
if (k === x) {
199199
var match = f(/* Some */[t.value]);
200-
if (match) {
200+
if (match !== /* None */0) {
201201
t.value = match[0];
202202
return t;
203203
} else {
@@ -227,7 +227,7 @@ function updateDone(t, x, f) {
227227
}
228228
} else {
229229
var match$1 = f(/* None */0);
230-
if (match$1) {
230+
if (match$1 !== /* None */0) {
231231
return Belt_internalAVLtree.singleton(x, match$1[0]);
232232
} else {
233233
return t;

lib/js/belt_MutableMapString.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ function updateDone(t, x, f) {
197197
var k = t.key;
198198
if (k === x) {
199199
var match = f(/* Some */[t.value]);
200-
if (match) {
200+
if (match !== /* None */0) {
201201
t.value = match[0];
202202
return t;
203203
} else {
@@ -227,7 +227,7 @@ function updateDone(t, x, f) {
227227
}
228228
} else {
229229
var match$1 = f(/* None */0);
230-
if (match$1) {
230+
if (match$1 !== /* None */0) {
231231
return Belt_internalAVLtree.singleton(x, match$1[0]);
232232
} else {
233233
return t;

lib/js/belt_Option.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
var Curry = require("./curry.js");
44

55
function getExn(param) {
6-
if (param) {
6+
if (param !== /* None */0) {
77
return param[0];
88
} else {
99
throw new Error("getExn");
1010
}
1111
}
1212

1313
function mapWithDefaultU(opt, $$default, f) {
14-
if (opt) {
14+
if (opt !== /* None */0) {
1515
return f(opt[0]);
1616
} else {
1717
return $$default;
@@ -23,7 +23,7 @@ function mapWithDefault(opt, $$default, f) {
2323
}
2424

2525
function mapU(opt, f) {
26-
if (opt) {
26+
if (opt !== /* None */0) {
2727
return /* Some */[f(opt[0])];
2828
} else {
2929
return /* None */0;
@@ -35,7 +35,7 @@ function map(opt, f) {
3535
}
3636

3737
function flatMapU(opt, f) {
38-
if (opt) {
38+
if (opt !== /* None */0) {
3939
return f(opt[0]);
4040
} else {
4141
return /* None */0;
@@ -47,37 +47,37 @@ function flatMap(opt, f) {
4747
}
4848

4949
function getWithDefault(opt, $$default) {
50-
if (opt) {
50+
if (opt !== /* None */0) {
5151
return opt[0];
5252
} else {
5353
return $$default;
5454
}
5555
}
5656

5757
function isSome(param) {
58-
if (param) {
58+
if (param !== /* None */0) {
5959
return true;
6060
} else {
6161
return false;
6262
}
6363
}
6464

6565
function isNone(param) {
66-
if (param) {
66+
if (param !== /* None */0) {
6767
return false;
6868
} else {
6969
return true;
7070
}
7171
}
7272

7373
function eqU(a, b, f) {
74-
if (a) {
75-
if (b) {
74+
if (a !== /* None */0) {
75+
if (b !== /* None */0) {
7676
return f(a[0], b[0]);
7777
} else {
7878
return false;
7979
}
80-
} else if (b) {
80+
} else if (b !== /* None */0) {
8181
return false;
8282
} else {
8383
return true;
@@ -89,13 +89,13 @@ function eq(a, b, f) {
8989
}
9090

9191
function cmpU(a, b, f) {
92-
if (a) {
93-
if (b) {
92+
if (a !== /* None */0) {
93+
if (b !== /* None */0) {
9494
return f(a[0], b[0]);
9595
} else {
9696
return 1;
9797
}
98-
} else if (b) {
98+
} else if (b !== /* None */0) {
9999
return -1;
100100
} else {
101101
return 0;

lib/js/belt_internalAVLtree.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ function concat(t1, t2) {
457457
}
458458

459459
function concatOrJoin(t1, v, d, t2) {
460-
if (d) {
460+
if (d !== /* None */0) {
461461
return join(t1, v, d[0], t2);
462462
} else {
463463
return concat(t1, t2);
@@ -492,7 +492,7 @@ function keepMapU(n, p) {
492492
var newLeft = keepMapU(n.left, p);
493493
var pvd = p(v, d);
494494
var newRight = keepMapU(n.right, p);
495-
if (pvd) {
495+
if (pvd !== /* None */0) {
496496
return join(newLeft, v, pvd[0], newRight);
497497
} else {
498498
return concat(newLeft, newRight);

lib/js/belt_internalBuckets.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ function filterMapInplaceBucket(f, h, i, _prec, _cell) {
162162
var prec = _prec;
163163
var n = cell.next;
164164
var match = f(cell.key, cell.value);
165-
if (match) {
165+
if (match !== /* None */0) {
166166
if (prec !== undefined) {
167167
cell.next = cell;
168168
} else {

lib/js/bigarray.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function dims() {
1414
}
1515

1616
function map_file(_, $staropt$star, _$1, _$2, _$3, _$4) {
17-
$staropt$star ? $staropt$star[0] : /* int64 */[
17+
$staropt$star !== /* None */0 ? $staropt$star[0] : /* int64 */[
1818
/* hi */0,
1919
/* lo */0
2020
];

lib/js/caml_basic.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function is_none(x) {
1010
}
1111

1212
function to_def(x) {
13-
if (x) {
13+
if (x !== /* None */0) {
1414
return x[0];
1515
} else {
1616
return undefined;

lib/js/caml_obj.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function caml_compare(_a, _b) {
160160
var b = param[1];
161161
if (!b.hasOwnProperty(key) || caml_compare(param[0][key], b[key]) > 0) {
162162
var match = min_key[0];
163-
if (match && key >= match[0]) {
163+
if (match !== /* None */0 && key >= match[0]) {
164164
return 0;
165165
} else {
166166
min_key[0] = /* Some */[key];
@@ -194,13 +194,13 @@ function caml_compare(_a, _b) {
194194
for_in(b$2, do_key_b);
195195
var match = min_key_lhs[0];
196196
var match$1 = min_key_rhs[0];
197-
if (match) {
198-
if (match$1) {
197+
if (match !== /* None */0) {
198+
if (match$1 !== /* None */0) {
199199
return Caml_primitive.caml_string_compare(match[0], match$1[0]);
200200
} else {
201201
return -1;
202202
}
203-
} else if (match$1) {
203+
} else if (match$1 !== /* None */0) {
204204
return 1;
205205
} else {
206206
return 0;

lib/js/caml_weak.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function caml_weak_create(n) {
99
}
1010

1111
function caml_weak_set(xs, i, v) {
12-
if (v) {
12+
if (v !== /* None */0) {
1313
xs[i] = v[0];
1414
return /* () */0;
1515
} else {

0 commit comments

Comments
 (0)