correct apply check and add apply opcode

This commit is contained in:
2026-02-21 19:43:05 -06:00
parent 017b63ba80
commit cec0b99207
3 changed files with 64 additions and 1 deletions

View File

@@ -2135,6 +2135,14 @@ var mcode = function(ast) {
emit_label(guard_done)
return a1
}
// apply(fn, arr) → direct opcode
if (nargs == 2 && fname == "apply") {
a0 = gen_expr(args_list[0], -1)
a1 = gen_expr(args_list[1], -1)
d = alloc_slot()
emit_3("apply", d, a0, a1)
return d
}
// Callback intrinsics → inline mcode loops
if (fname == "arrfor" && nargs >= 2 && nargs <= 4 && inline_arrfor) {
a0 = gen_expr(args_list[0], -1)