Skip to content

Commit

Permalink
Compiler: better name for global js name
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Oct 1, 2024
1 parent ef42a56 commit a37e1bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions compiler/bin-js_of_ocaml/build_fs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ function jsoo_create_file_extern(name,content){
if(globalThis.jsoo_create_file)
globalThis.jsoo_create_file(name,content);
else {
if(!globalThis.caml_fs_tmp) globalThis.caml_fs_tmp = [];
globalThis.caml_fs_tmp.push({name:name,content:content});
if(!globalThis.jsoo_fs_tmp) globalThis.jsoo_fs_tmp = [];
globalThis.jsoo_fs_tmp.push({name:name,content:content});
}
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/tests-full/fs.expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
if(c.jsoo_create_file)
c.jsoo_create_file(a, b);
else{
if(! c.caml_fs_tmp) c.caml_fs_tmp = [];
c.caml_fs_tmp.push({name: a, content: b});
if(! c.jsoo_fs_tmp) c.jsoo_fs_tmp = [];
c.jsoo_fs_tmp.push({name: a, content: b});
}
return 0;
}
Expand Down
8 changes: 4 additions & 4 deletions runtime/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,23 +300,23 @@ function caml_ba_map_file_bytecode(argv, argn) {
function jsoo_create_file_extern(name, content) {
if (globalThis.jsoo_create_file) globalThis.jsoo_create_file(name, content);
else {
if (!globalThis.caml_fs_tmp) globalThis.caml_fs_tmp = [];
globalThis.caml_fs_tmp.push({ name: name, content: content });
if (!globalThis.jsoo_fs_tmp) globalThis.jsoo_fs_tmp = [];
globalThis.jsoo_fs_tmp.push({ name: name, content: content });
}
return 0;
}

//Provides: caml_fs_init
//Requires: jsoo_create_file
function caml_fs_init() {
var tmp = globalThis.caml_fs_tmp;
var tmp = globalThis.jsoo_fs_tmp;
if (tmp) {
for (var i = 0; i < tmp.length; i++) {
jsoo_create_file(tmp[i].name, tmp[i].content);
}
}
globalThis.jsoo_create_file = jsoo_create_file;
globalThis.caml_fs_tmp = [];
globalThis.jsoo_fs_tmp = [];
return 0;
}

Expand Down

0 comments on commit a37e1bf

Please sign in to comment.