Skip to content

Commit 11cff6a

Browse files
committed
Merge pull request #76 from bloomberg/fix_browser_reload
Fix browser reload
2 parents 52eb3a5 + 3162232 commit 11cff6a

File tree

8 files changed

+29
-26
lines changed

8 files changed

+29
-26
lines changed

jscomp/js_dump.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,7 @@ let pp_program (program : J.program) (f : Ext_pp.t) =
14201420
begin match Sys.getenv "OCAML_AMD_MODULE" with
14211421
| exception Not_found ->
14221422
ignore (node_program f program)
1423+
(* amd_program f program *)
14231424
| _ -> amd_program f program
14241425
end ) ;
14251426
P.newline f ;

jscomp/js_generate_require.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
let std_files =
33
String_set.elements Js_config.stdlib_set
4-
|> List.map (fun x -> "./stdlib/" ^ x )
4+
|> List.map (fun x -> "./stdlib/" ^ Filename.chop_extension x )
55
let runtime_files =
66
String_set.elements Js_config.runtime_set
7-
|> List.map (fun x -> "./runtime/" ^ x)
7+
|> List.map (fun x -> "./runtime/" ^ Filename.chop_extension x)
88

99
let () =
1010
Ext_pervasives.with_file_as_chan "./pre_load.js" (fun chan ->

jscomp/js_program_loader.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ let string_of_module_id (x : module_id) : string =
3939
->
4040
let target = String.uncapitalize file in
4141
if String_set.mem target Js_config.runtime_set then
42-
"./runtime/" ^ target
42+
"./runtime/" ^ Filename.chop_extension target
4343
else
44-
"./stdlib/" ^ target
44+
"./stdlib/" ^ Filename.chop_extension target
4545
| NodeJS ->
4646
if Ext_string.starts_with id.name "Caml_" then
4747
let path =

jscomp/lam_dispatch_primitive.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ let query (prim : Lam_compile_env.primitive_description)
470470
| "caml_array_blit"
471471
| "caml_make_vect" ->
472472
E.runtime_call Js_helper.array prim.prim_name args
473-
473+
| "caml_ml_flush"
474474
| "caml_ml_out_channels_list"
475475
| "caml_ml_open_descriptor_in"
476476
| "caml_ml_open_descriptor_out"
@@ -576,7 +576,7 @@ let query (prim : Lam_compile_env.primitive_description)
576576
| "caml_sys_close"
577577
| "caml_int64_of_string"
578578
| "caml_sys_open"
579-
| "caml_ml_flush"
579+
580580
| "caml_ml_input"
581581
| "caml_ml_input_scan_line"
582582
| "caml_ml_input_int"

jscomp/runtime/caml_io.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ function caml_ml_flush(oc) {
280280
oc.buffer = "";
281281
return 0;
282282
}
283+
exports.caml_ml_flush = caml_ml_flush;
283284
function caml_ml_output(oc, buffer, offset, len) {
284285
if (!oc.opened)
285286
caml_exceptions_1.caml_raise_sys_error("Cannot output to a closed channel");

jscomp/runtime/caml_io.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,5 +389,6 @@ export {
389389
caml_ml_output_char,
390390
caml_ml_output,
391391
caml_ml_input_char,
392-
caml_ml_out_channels_list
392+
caml_ml_out_channels_list,
393+
caml_ml_flush
393394
}

jscomp/stdlib/pervasives.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ function flush_all() {
223223
var param = _param;
224224
if (param) {
225225
try {
226-
Caml_primitive.caml_ml_flush(param[1]);
226+
Caml_io.caml_ml_flush(param[1]);
227227
}
228228
catch (exn){
229229

@@ -275,13 +275,13 @@ function output_value(chan, v) {
275275
}
276276

277277
function close_out(oc) {
278-
Caml_primitive.caml_ml_flush(oc);
278+
Caml_io.caml_ml_flush(oc);
279279
return Caml_primitive.caml_ml_close_channel(oc);
280280
}
281281

282282
function close_out_noerr(oc) {
283283
try {
284-
Caml_primitive.caml_ml_flush(oc);
284+
Caml_io.caml_ml_flush(oc);
285285
}
286286
catch (exn){
287287

@@ -468,7 +468,7 @@ var print_endline = console.log;
468468

469469
function print_newline() {
470470
Caml_io.caml_ml_output_char(stdout, /* "\n" */10);
471-
return Caml_primitive.caml_ml_flush(stdout);
471+
return Caml_io.caml_ml_flush(stdout);
472472
}
473473

474474
function prerr_char(c) {
@@ -495,20 +495,20 @@ var prerr_endline = console.error;
495495

496496
function prerr_newline() {
497497
Caml_io.caml_ml_output_char(stderr, /* "\n" */10);
498-
return Caml_primitive.caml_ml_flush(stderr);
498+
return Caml_io.caml_ml_flush(stderr);
499499
}
500500

501501
function read_line() {
502-
Caml_primitive.caml_ml_flush(stdout);
502+
Caml_io.caml_ml_flush(stdout);
503503
return input_line(stdin);
504504
}
505505

506506
function read_int() {
507-
return Caml_format.caml_int_of_string((Caml_primitive.caml_ml_flush(stdout), input_line(stdin)));
507+
return Caml_format.caml_int_of_string((Caml_io.caml_ml_flush(stdout), input_line(stdin)));
508508
}
509509

510510
function read_float() {
511-
return Caml_format.caml_float_of_string((Caml_primitive.caml_ml_flush(stdout), input_line(stdin)));
511+
return Caml_format.caml_float_of_string((Caml_io.caml_ml_flush(stdout), input_line(stdin)));
512512
}
513513

514514
function string_of_format(param) {
@@ -547,7 +547,7 @@ function exit(retcode) {
547547
}
548548

549549
function flush(prim) {
550-
return Caml_primitive.caml_ml_flush(prim);
550+
return Caml_io.caml_ml_flush(prim);
551551
}
552552

553553
function output_char(prim, prim$1) {

jscomp/test/test_per.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ function flush_all() {
229229
var param = _param;
230230
if (param) {
231231
try {
232-
Caml_primitive.caml_ml_flush(param[1]);
232+
Caml_io.caml_ml_flush(param[1]);
233233
}
234234
catch (exn){
235235

@@ -281,13 +281,13 @@ function output_value(chan, v) {
281281
}
282282

283283
function close_out(oc) {
284-
Caml_primitive.caml_ml_flush(oc);
284+
Caml_io.caml_ml_flush(oc);
285285
return Caml_primitive.caml_ml_close_channel(oc);
286286
}
287287

288288
function close_out_noerr(oc) {
289289
try {
290-
Caml_primitive.caml_ml_flush(oc);
290+
Caml_io.caml_ml_flush(oc);
291291
}
292292
catch (exn){
293293

@@ -472,12 +472,12 @@ function print_float(f) {
472472
function print_endline(s) {
473473
output_string(stdout, s);
474474
Caml_io.caml_ml_output_char(stdout, /* "\n" */10);
475-
return Caml_primitive.caml_ml_flush(stdout);
475+
return Caml_io.caml_ml_flush(stdout);
476476
}
477477

478478
function print_newline() {
479479
Caml_io.caml_ml_output_char(stdout, /* "\n" */10);
480-
return Caml_primitive.caml_ml_flush(stdout);
480+
return Caml_io.caml_ml_flush(stdout);
481481
}
482482

483483
function prerr_char(c) {
@@ -503,25 +503,25 @@ function prerr_float(f) {
503503
function prerr_endline(s) {
504504
output_string(stderr, s);
505505
Caml_io.caml_ml_output_char(stderr, /* "\n" */10);
506-
return Caml_primitive.caml_ml_flush(stderr);
506+
return Caml_io.caml_ml_flush(stderr);
507507
}
508508

509509
function prerr_newline() {
510510
Caml_io.caml_ml_output_char(stderr, /* "\n" */10);
511-
return Caml_primitive.caml_ml_flush(stderr);
511+
return Caml_io.caml_ml_flush(stderr);
512512
}
513513

514514
function read_line() {
515-
Caml_primitive.caml_ml_flush(stdout);
515+
Caml_io.caml_ml_flush(stdout);
516516
return input_line(stdin);
517517
}
518518

519519
function read_int() {
520-
return Caml_format.caml_int_of_string((Caml_primitive.caml_ml_flush(stdout), input_line(stdin)));
520+
return Caml_format.caml_int_of_string((Caml_io.caml_ml_flush(stdout), input_line(stdin)));
521521
}
522522

523523
function read_float() {
524-
return Caml_format.caml_float_of_string((Caml_primitive.caml_ml_flush(stdout), input_line(stdin)));
524+
return Caml_format.caml_float_of_string((Caml_io.caml_ml_flush(stdout), input_line(stdin)));
525525
}
526526

527527
var LargeFile = [0];

0 commit comments

Comments
 (0)