Skip to content

Commit

Permalink
adapt for wasmoo
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Dec 5, 2024
1 parent 00e6457 commit 234d5ae
Showing 1 changed file with 16 additions and 40 deletions.
56 changes: 16 additions & 40 deletions runtime/wasm/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,72 +228,48 @@
for (let i = 0; i < l; i++) string_set(s, p2 + i, a[p1 + i]);
},
wrap_callback: (f) =>
function () {
var n = arguments.length;
if (n > 0) {
var args = new Array(n);
for (var i = 0; i < n; i++) args[i] = arguments[i];
} else {
function (...args) {
if (args.length === 0) {
args = [undefined];
}
return caml_callback(f, args.length, args, 1);
},
wrap_callback_args: (f) =>
function () {
var n = arguments.length;
var args = new Array(n);
for (var i = 0; i < n; i++) args[i] = arguments[i];
function (...args) {
return caml_callback(f, 1, [args], 0);
},
wrap_callback_strict: (arity, f) =>
function () {
var n = arguments.length;
var args = new Array(arity);
var len = Math.min(arguments.length, arity);
for (var i = 0; i < len; i++) args[i] = arguments[i];
function (...args) {
args.length = arity;
return caml_callback(f, arity, args, 0);
},
wrap_callback_unsafe: (f) =>
function () {
var n = arguments.length;
var args = new Array(n);
for (var i = 0; i < n; i++) args[i] = arguments[i];
function (...args) {
return caml_callback(f, args.length, args, 2);
},
wrap_meth_callback: (f) =>
function () {
var n = arguments.length;
var args = new Array(n + 1);
args[0] = this;
for (var i = 0; i < n; i++) args[i + 1] = arguments[i];
function (...args) {
args.unshift(this);
return caml_callback(f, args.length, args, 1);
},
wrap_meth_callback_args: (f) =>
function () {
var n = arguments.length;
var args = new Array(n);
for (var i = 0; i < n; i++) args[i] = arguments[i];
function (...args) {
return caml_callback(f, 2, [this, args], 0);
},
wrap_meth_callback_strict: (arity, f) =>
function () {
var args = new Array(arity + 1);
var len = Math.min(arguments.length, arity);
args[0] = this;
for (var i = 0; i < len; i++) args[i + 1] = arguments[i];
function (...args) {
args.length = arity;
args.unshift(this);
return caml_callback(f, args.length, args, 0);
},
wrap_meth_callback_unsafe: (f) =>
function () {
var n = arguments.length;
var args = new Array(n + 1);
args[0] = this;
for (var i = 0; i < n; i++) args[i + 1] = arguments[i];
function (...args) {
args.unshift(this);
return caml_callback(f, args.length, args, 2);
},
wrap_fun_arguments: (f) =>
function () {
return f(arguments);
function (...args) {
return f(args);
},
format_float: (prec, conversion, pad, x) => {
function toFixed(x, dp) {
Expand Down

0 comments on commit 234d5ae

Please sign in to comment.