HS Bucket F: array literal arg to JS fn fix (+1 test)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 18s

Generator emit_eval translates arr.reduce/map/filter to SX primitives
so SX list args work. host-call-fn sxToJs converts SX lists to native
JS arrays for native JS function calls. Fixes functionCalls
"can pass an array literal as an argument".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 15:36:23 +00:00
parent f38558fcc1
commit da2e6b1bca
3 changed files with 9 additions and 2 deletions

View File

@@ -1666,6 +1666,13 @@ def js_expr_to_sx(expr):
if s is None:
return None
arg_sx.append(s)
# Translate common array HO methods to SX primitives so SX lists work.
if method == 'reduce' and len(arg_sx) == 2:
return f'(reduce {arg_sx[0]} {arg_sx[1]} {obj})'
if method == 'map' and len(arg_sx) == 1:
return f'(map {arg_sx[0]} {obj})'
if method == 'filter' and len(arg_sx) == 1:
return f'(filter {arg_sx[0]} {obj})'
return f'(host-call {obj} "{method}" {" ".join(arg_sx)})'.strip()
# Property access: o.prop