fix fuse bug

This commit is contained in:
2026-02-22 10:34:55 -06:00
parent 1d4fc11772
commit a05f180356
4 changed files with 6 additions and 22 deletions

View File

@@ -878,7 +878,7 @@ var mcode = function(ast) {
var inline_every = true
var inline_some = true
var inline_reduce = true
var inline_map = true
var inline_map = false
var inline_find = true
// --- Helper: emit arity-dispatched callback invocation ---
@@ -2186,25 +2186,7 @@ var mcode = function(ast) {
d = alloc_slot()
return expand_inline_reduce(d, {arr: a0, fn: a1, init: a2, rev: a3}, nargs)
}
// array(arr, fn) inline map expansion
// Skip when first arg is a number literal (that's array(N, fn) — creation, not map)
if (nargs == 2 && fname == "array" && inline_map
&& args_list[0].kind != "number") {
// Specialized: array(arr, known_sensory_intrinsic) → direct opcode loop
if (args_list[1].kind == "name" && args_list[1].intrinsic == true
&& sensory_ops[args_list[1].name] != null) {
a0 = gen_expr(args_list[0], -1)
d = alloc_slot()
return expand_inline_map_intrinsic(d, a0, sensory_ops[args_list[1].name])
}
// General: array(arr, fn_literal) → map loop with arity dispatch
if (args_list[1].kind == "function") {
a0 = gen_expr(args_list[0], -1)
a1 = gen_expr(args_list[1], -1)
d = alloc_slot()
return expand_inline_map(d, a0, a1)
}
}
// array(arr, fn) inline expansion removed — array() is too complex to inline
}
// Collect arg slots