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
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user