js-on-sx: Function global stub (constructor throws, prototype has stubs)

Several tests check 'new Function("return 1")' — we can't actually
implement that (would need runtime JS eval). Now Function is a dict with
__callable__ that throws TypeError, and a prototype containing call/apply/
bind/toString/length/name stubs so code that probes Function.prototype
doesn't crash with 'Undefined symbol: Function'.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 09:54:42 +00:00
parent 9da43877e8
commit 38e9376573
2 changed files with 57 additions and 54 deletions

View File

@@ -161,6 +161,7 @@
((= name "Infinity") (list (js-sym "js-infinity-value")))
((= name "eval") (js-sym "js-global-eval"))
((= name "globalThis") (js-sym "js-global"))
((= name "Function") (js-sym "js-function-global"))
(else (js-sym name)))))
;; ── Unary ops ─────────────────────────────────────────────────────