Skip to content

Commit a1ec950

Browse files
committed
fix
1 parent dd21c9b commit a1ec950

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

compiler/lib/generate.ml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ let plus_int x y =
339339

340340
let bool e = J.ECond (e, one, zero)
341341

342+
let bool_not e = J.ECond (e, zero, one)
343+
342344
(****)
343345

344346
let source_location ctx ?force (pc : Code.loc) =
@@ -1471,13 +1473,11 @@ let rec translate_expr ctx queue loc x e level : _ * J.statement_list =
14711473
| Neq, [ x; y ] ->
14721474
let (px, cx), queue = access_queue' ~ctx queue x in
14731475
let (py, cy), queue = access_queue' ~ctx queue y in
1474-
( J.EBin
1475-
( J.Minus
1476-
, one
1477-
, J.call
1478-
(J.dot (s_var "Object") (Utf8_string.of_string_exn "is"))
1479-
[ cx; cy ]
1480-
loc )
1476+
( bool_not
1477+
(J.call
1478+
(J.dot (s_var "Object") (Utf8_string.of_string_exn "is"))
1479+
[ cx; cy ]
1480+
loc)
14811481
, or_p px py
14821482
, queue )
14831483
| IsInt, [ x ] ->

runtime/io.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function caml_sys_open_internal(file,idx) {
4545
idx = caml_sys_fds.length;
4646
}
4747
caml_sys_fds[idx] = file;
48-
return idx;
48+
return idx | 0;
4949
}
5050
function caml_sys_open (name, flags, _perms) {
5151
var f = {};
@@ -92,7 +92,7 @@ function caml_sys_open (name, flags, _perms) {
9292
function caml_ml_set_channel_name(chanid, name) {
9393
var chan = caml_ml_channels[chanid];
9494
chan.name = name;
95-
return 0
95+
return 0;
9696
}
9797

9898
//Provides: caml_ml_channels
@@ -271,7 +271,7 @@ function caml_ml_input_block (chanid, ba, i, l) {
271271
ba.set(chan.buffer.subarray(chan.buffer_curr,chan.buffer_curr + n), i);
272272
chan.buffer_curr += n;
273273
}
274-
return n;
274+
return n | 0;
275275
}
276276

277277
//Provides: caml_input_value
@@ -344,9 +344,9 @@ function caml_ml_input_int (chanid) {
344344
var chan = caml_ml_channels[chanid];
345345
var res = 0;
346346
for(var i = 0; i < 4; i++){
347-
res = (res << 8) + caml_ml_input_char(chanid);
347+
res = (res << 8) + caml_ml_input_char(chanid) | 0;
348348
}
349-
return res;
349+
return res | 0;
350350
}
351351

352352
//Provides: caml_seek_in
@@ -383,7 +383,7 @@ function caml_ml_seek_in_64(chanid,pos){
383383
//Requires: caml_ml_channels
384384
function caml_pos_in(chanid) {
385385
var chan = caml_ml_channels[chanid];
386-
return chan.offset - (chan.buffer_max - chan.buffer_curr);
386+
return chan.offset - (chan.buffer_max - chan.buffer_curr) | 0;
387387
}
388388

389389
//Provides: caml_ml_pos_in
@@ -413,16 +413,16 @@ function caml_ml_input_scan_line(chanid){
413413
chan.buffer_curr = 0;
414414
}
415415
if(chan.buffer_max >= chan.buffer.length) {
416-
return -(chan.buffer_max);
416+
return -(chan.buffer_max) | 0;
417417
}
418418
var prev_max = chan.buffer_max;
419419
caml_refill (chan);
420420
if(prev_max == chan.buffer_max) {
421-
return -(chan.buffer_max);
421+
return -(chan.buffer_max) | 0;
422422
}
423423
}
424424
} while (chan.buffer[p++] != 10);
425-
return p - chan.buffer_curr;
425+
return (p - chan.buffer_curr) | 0;
426426
}
427427

428428
//Provides: caml_ml_flush

0 commit comments

Comments
 (0)