Skip to content

Commit 13dd856

Browse files
committed
fix
1 parent c67ada8 commit 13dd856

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 ?after pc =
@@ -1463,13 +1465,11 @@ let rec translate_expr ctx queue loc x e level : _ * J.statement_list =
14631465
| Neq, [ x; y ] ->
14641466
let (px, cx), queue = access_queue' ~ctx queue x in
14651467
let (py, cy), queue = access_queue' ~ctx queue y in
1466-
( J.EBin
1467-
( J.Minus
1468-
, one
1469-
, J.call
1470-
(J.dot (s_var "Object") (Utf8_string.of_string_exn "is"))
1471-
[ cx; cy ]
1472-
loc )
1468+
( bool_not
1469+
(J.call
1470+
(J.dot (s_var "Object") (Utf8_string.of_string_exn "is"))
1471+
[ cx; cy ]
1472+
loc)
14731473
, or_p px py
14741474
, queue )
14751475
| 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
@@ -343,9 +343,9 @@ function caml_ml_input_int (chanid) {
343343
var chan = caml_ml_channels[chanid];
344344
var res = 0;
345345
for(var i = 0; i < 4; i++){
346-
res = (res << 8) + caml_ml_input_char(chanid);
346+
res = (res << 8) + caml_ml_input_char(chanid) | 0;
347347
}
348-
return res;
348+
return res | 0;
349349
}
350350

351351
//Provides: caml_seek_in
@@ -382,7 +382,7 @@ function caml_ml_seek_in_64(chanid,pos){
382382
//Requires: caml_ml_channels
383383
function caml_pos_in(chanid) {
384384
var chan = caml_ml_channels[chanid];
385-
return chan.offset - (chan.buffer_max - chan.buffer_curr);
385+
return chan.offset - (chan.buffer_max - chan.buffer_curr) | 0;
386386
}
387387

388388
//Provides: caml_ml_pos_in
@@ -412,16 +412,16 @@ function caml_ml_input_scan_line(chanid){
412412
chan.buffer_curr = 0;
413413
}
414414
if(chan.buffer_max >= chan.buffer.length) {
415-
return -(chan.buffer_max);
415+
return -(chan.buffer_max) | 0;
416416
}
417417
var prev_max = chan.buffer_max;
418418
caml_refill (chan);
419419
if(prev_max == chan.buffer_max) {
420-
return -(chan.buffer_max);
420+
return -(chan.buffer_max) | 0;
421421
}
422422
}
423423
} while (chan.buffer[p++] != 10);
424-
return p - chan.buffer_curr;
424+
return (p - chan.buffer_curr) | 0;
425425
}
426426

427427
//Provides: caml_ml_flush

0 commit comments

Comments
 (0)